@font-face {
    font-family: 'Inter';
    src: url('../../assets/fonts/Inter.ttf') format('truetype');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #3b82f6;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-light: #64748b;
    --text-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --radius-sm: 10px;
    --radius: 12px;
    --radius-lg: 16px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: 0.3s ease;
}

.dark-theme {
    --bg-color: #0a1929;
    --card-bg: #112233;
    --text-color: #e9ecef;
    --text-light: #8696a7;
    --border-color: #334b61;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font);
    background: linear-gradient(135deg, var(--bg-color) 0%, #e2e8f0 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100dvh;
    transition: background var(--transition), color var(--transition);
}
body.dark-theme {
    background: var(--bg-color);
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    width: 100%;
}

.app-header {
    background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 50%, #1a365d 100%);
    color: white;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-content h1 {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.theme-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.25); transition: .3s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background: var(--accent-color); }
input:checked + .slider:before { transform: translateX(20px); }

.app-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

#inputs-column, #outputs-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
}

.card h2 {
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-color);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 0.5rem;
}

.main-button {
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font);
    flex: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
}

.main-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37,99,235,0.3);
}

.main-button:active {
    transform: scale(0.97);
}

.result-placeholder {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.9rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.result-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    color: var(--accent-color);
}

.result-header {
    background: #eff6ff;
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--primary-color);
    margin-bottom: 1rem;
}
body.dark-theme .result-header {
    background: #1a2a3a;
}

.result-header h3 {
    font-size: 1rem;
    color: var(--text-color);
    margin: 0;
}

.result-images {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.result-image {
    flex: 1;
    min-width: 300px;
    max-width: calc(50% - 10px);
    text-align: center;
}

.result-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.result-image img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.result-table-wrapper {
    overflow-x: auto;
}

.result-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
}

.result-table-wrapper th {
    padding: 12px;
    border: 1px solid var(--border-color);
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    text-align: left;
}

.result-table-wrapper td {
    padding: 8px;
    border: 1px solid var(--border-color);
}

.result-table-wrapper .value {
    font-weight: 600;
}

@media (max-width: 1024px) {
    .app-main { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .app-main, .card { padding: 1rem; }
    .button-group { flex-direction: column; }
    .input-grid { grid-template-columns: 1fr; }
    .result-image { min-width: 100%; max-width: 100%; }
    .result-images { flex-direction: column; }
}

@media (max-width: 480px) {
    .app-main { padding: 0; gap: 0.75rem; }
    #inputs-column, #outputs-column { gap: 0.75rem; }
    .card { padding: 0.75rem; border-radius: 0; }
    .app-header h1 { font-size: 0.9rem; }
}
