:root {
    --bg-deep: #f0f2f5;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --secondary: #db2777;
    --accent: #0891b2;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --glass: rgba(255, 255, 255, 0.9);
}

/* TOGGLE SWITCH */
.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    -webkit-transform: translateX(14px);
    -ms-transform: translateX(14px);
    transform: translateX(14px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(219, 39, 119, 0.05) 0%, transparent 40%);
}

#app-ui {
    padding: 1rem 2rem;
    width: 100%;
    max-width: 100%;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    color: var(--primary);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Content Areas */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

.grid-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
}

.full-width {
    width: 100%;
}


/* Shared Components */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    margin-bottom: 2rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-family: inherit;
    margin-bottom: 1.5rem;
    transition: border 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Checkbox Group */
.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    background: var(--bg-deep);
}

.checkbox-item:hover {
    border-color: var(--primary);
}

.checkbox-item input {
    margin-bottom: 0;
    width: auto;
}

.checkbox-item label {
    margin-bottom: 0;
    font-size: 0.8rem;
    cursor: pointer;
}

button.btn-primary {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

button.btn-primary:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

button.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    background: var(--bg-deep);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--bg-deep);
}

.data-row.clickable {
    cursor: pointer;
}

.data-row.active td {
    background: var(--primary-glow);
    border-left: 3px solid var(--primary);
}

.tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    background: rgba(8, 145, 178, 0.1);
    color: var(--accent);
    display: inline-block;
}

.tag.success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.tag.failed {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Report Viz */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: var(--bg-deep);
    padding: 1.25rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.symptom-card {
    background: var(--bg-deep);
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--accent);
}

/* Markdown Styles */
.md-content h1 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.md-content h2,
.md-content h3 {
    color: var(--secondary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.md-content ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.md-content p {
    margin-bottom: 1rem;
    color: var(--text-main);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Loader */
.loader {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
    border: 2px solid rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s infinite linear;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.5rem;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-btn:hover {
    color: var(--text-main);
}

/* Sidebar & App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #0f172a;
    color: white;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 50;
    height: 100vh;
    position: sticky;
    top: 0;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 70px;
    padding: 1.5rem 0.5rem;
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-header-text,
.sidebar.collapsed .sidebar-user-details,
.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

.sidebar-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    padding-left: 1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.2) 0%, rgba(79, 70, 229, 0.05) 100%);
    color: white;
    border-left-color: var(--primary);
}

.nav-icon {
    width: 24px;
    text-align: center;
    font-size: 1.2rem;
}

.nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    margin: 1.5rem 0 0.5rem;
    padding-left: 1rem;
    font-weight: 700;
}

.main-workspace {
    flex: 1;
    padding: 2rem;
    background: var(--bg-deep);
}

.psy-chip code {
    font-family: monospace;
    font-size: 12px;
    color: white;
    background: transparent;
    padding: 0;
}

.psy-callout {
    border: 1px dashed rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .03);
    padding: 12px 14px;
    border-radius: 16px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.psy-codebox {
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, .90);
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 16px;
    padding: 14px;
    overflow: auto;
    max-height: 420px;
    white-space: pre;
}

@media (max-width: 1000px) {
    .psy-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 680px) {
    .psy-grid {
        grid-template-columns: 1fr;
    }
}
