/* Softeconomics Tools - Theme & Design System */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    /* Base Font */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Light Theme Palette */
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-input: #ffffff;
    --bg-code: #0f172a;
    --border-subtle: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-strong: #94a3b8;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    --color-primary: #0284c7;
    --color-primary-hover: #0369a1;
    --color-primary-light: #e0f2fe;

    --color-success: #10b981;
    --color-success-light: #ecfdf5;
    --color-warning: #f59e0b;
    --color-warning-light: #fffbeb;
    --color-danger: #ef4444;
    --color-danger-light: #fef2f2;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --sidebar-width: 280px;
    --sidebar-width-collapsed: 74px;
}

html.dark, html[data-theme='dark'] {
    /* Dark Theme Palette */
    --bg-app: #090d16;
    --bg-surface: #0f172a;
    --bg-surface-elevated: #1e293b;
    --bg-input: #020617;
    --bg-code: #020617;
    --border-subtle: #1e293b;
    --border-medium: #334155;
    --border-strong: #475569;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;

    --color-primary: #38bdf8;
    --color-primary-hover: #0ea5e9;
    --color-primary-light: rgba(56, 189, 248, 0.12);

    --color-success: #34d399;
    --color-success-light: rgba(52, 211, 153, 0.12);
    --color-warning: #fbbf24;
    --color-warning-light: rgba(251, 191, 36, 0.12);
    --color-danger: #f87171;
    --color-danger-light: rgba(248, 113, 113, 0.12);

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

/* Layout Elements */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-container.sidebar-collapsed .sidebar {
    width: var(--sidebar-width-collapsed);
}

.app-container.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-width-collapsed);
    width: calc(100% - var(--sidebar-width-collapsed));
}

/* Top Navbar */
.top-navbar {
    height: 64px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(8px);
}

/* Content Area */
.content-body {
    flex: 1;
    padding: 1.5rem;
    max-width: 1800px;
    width: 100%;
    margin: 0 auto;
}

/* Cards & Surfaces */
.card-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.card-box:hover {
    border-color: var(--border-medium);
}

.card-box.interactive:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Buttons */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    user-select: none;
}

.btn-modern:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.35);
}

.btn-secondary {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    border-color: var(--border-medium);
}
.btn-secondary:hover {
    background-color: var(--border-subtle);
    border-color: var(--border-strong);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Inputs & Form Controls */
.form-input, .form-select, .form-textarea {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-textarea {
    font-family: var(--font-mono);
    resize: vertical;
}

/* Monospace Code font */
.font-mono {
    font-family: var(--font-mono);
}

/* Checkbox Labels */
.checkbox-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    color: var(--text-secondary);
}
.checkbox-card:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.checkbox-card input[type="checkbox"] {
    accent-color: #0284c7;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
}

.badge-emerald {
    background-color: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-sky {
    background-color: rgba(2, 132, 199, 0.12);
    color: #0284c7;
    border: 1px solid rgba(2, 132, 199, 0.25);
}

.badge-amber {
    background-color: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Column Pills */
.col-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
}
.col-pill:hover {
    background-color: var(--color-primary-light);
    border-color: var(--color-primary);
    transform: scale(1.02);
}
.col-pill .tag-letter {
    color: #0284c7;
    font-weight: 700;
}
html.dark .col-pill .tag-letter {
    color: #38bdf8;
}

/* Tables */
.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    text-align: left;
}
.modern-table th {
    background-color: var(--bg-surface-elevated);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-medium);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
.modern-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    white-space: nowrap;
}
.modern-table tr:hover td {
    background-color: var(--bg-surface-elevated);
}

/* Code Terminal */
.code-terminal {
    background-color: var(--bg-code);
    color: #34d399;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow: auto;
}

/* Toast Banner */
.toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast-item {
    pointer-events: auto;
    min-width: 280px;
    max-width: 420px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.25s ease-out;
    border: 1px solid;
}
.toast-item.success {
    background-color: #064e3b;
    border-color: #059669;
    color: #a7f3d0;
}
.toast-item.error {
    background-color: #7f1d1d;
    border-color: #dc2626;
    color: #fecaca;
}
.toast-item.info {
    background-color: #0c4a6e;
    border-color: #0284c7;
    color: #bae6fd;
}
.toast-item.warning {
    background-color: #78350f;
    border-color: #d97706;
    color: #fde68a;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .sidebar {
        width: var(--sidebar-width-collapsed);
    }
    .main-content {
        margin-left: var(--sidebar-width-collapsed) !important;
        width: calc(100% - var(--sidebar-width-collapsed)) !important;
    }
}
