/* Base styles */
:root {
    --sidebar-width: 260px;
    --color-bg: #f8fafc;
    --color-sidebar: #0f172a;
    --color-sidebar-hover: #1e293b;
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-white: #ffffff;
    --color-success: #22c55e;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
    font-size: 14px;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-hover);
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar);
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
}

.logo-text {
    font-weight: 600;
    color: white;
    font-size: 16px;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    transition: all 0.15s ease;
    font-size: 14px;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--color-sidebar-hover);
    color: white;
    text-decoration: none;
}

.nav-item.active {
    background: var(--color-primary);
    color: white;
}

.nav-item.muted {
    color: #475569;
    font-style: italic;
    font-size: 13px;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--color-danger);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 13px;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    color: white;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    max-width: 1200px;
}

/* Page Header */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--color-text-muted);
    font-size: 15px;
}

.page-header-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    color: white;
}

.btn-secondary {
    background: var(--color-white);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg);
    border-color: #cbd5e1;
}

.btn-ghost {
    background: transparent;
    color: #94a3b8;
}

.btn-ghost:hover {
    background: var(--color-sidebar-hover);
    color: white;
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
    color: white;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Cards */
.card {
    background: var(--color-white);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* Model Grid */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.model-card {
    background: var(--color-white);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 24px;
    transition: all 0.2s ease;
    display: block;
    color: inherit;
}

.model-card:hover {
    text-decoration: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.model-card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.model-card-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.model-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
}

.model-card p {
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.model-card-locked {
    opacity: 0.7;
}

.model-card-locked:hover {
    transform: none;
    border-color: var(--color-border);
}

.model-card-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.model-card-meta {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Section */
.section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--color-white);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    background: var(--color-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.empty-state-icon svg {
    width: 32px;
    height: 32px;
    color: var(--color-text-muted);
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

/* Tables */
.table-container {
    background: var(--color-white);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

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

.doc-table th,
.doc-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.doc-table th {
    background: var(--color-bg);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.doc-table tr:last-child td {
    border-bottom: none;
}

.doc-table tr:hover td {
    background: var(--color-bg);
}

.doc-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.doc-icon {
    width: 36px;
    height: 36px;
    background: #fee2e2;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #dc2626;
}

.doc-icon.csv {
    background: #dcfce7;
    color: #16a34a;
}

.doc-icon.md {
    background: #dbeafe;
    color: #2563eb;
}

.doc-actions {
    display: flex;
    gap: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--color-text);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Auth pages */
.auth-layout {
    display: flex;
    min-height: 100vh;
}

.auth-sidebar {
    width: 50%;
    background: linear-gradient(135deg, var(--color-sidebar), #1e293b);
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: white;
}

.auth-sidebar h1 {
    font-size: 32px;
    margin-bottom: 16px;
}

.auth-sidebar p {
    font-size: 18px;
    color: #94a3b8;
    line-height: 1.6;
}

.auth-main {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.auth-card .subtitle {
    color: var(--color-text-muted);
    margin-bottom: 32px;
}

.auth-link {
    margin-top: 24px;
    text-align: center;
    color: var(--color-text-muted);
}

/* Alerts */
.messages {
    margin-bottom: 24px;
}

.alert {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 14px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-approved {
    background: #dcfce7;
    color: #166534;
}

.badge-denied {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Request list */
.request-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.request-item {
    background: var(--color-white);
    padding: 16px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.request-item .badge {
    flex-shrink: 0;
}

.request-info {
    flex: 1;
}

.request-info strong {
    display: block;
    margin-bottom: 4px;
}

.request-info .text-muted {
    font-size: 13px;
}

.request-actions {
    display: flex;
    gap: 8px;
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}

.back-link:hover {
    color: var(--color-primary);
}

/* Utility */
.text-muted {
    color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 72px;
    }

    .logo-text,
    .nav-section-title,
    .user-info,
    .nav-item span:not(.badge) {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .main-content {
        margin-left: 72px;
        padding: 24px;
    }

    .auth-sidebar {
        display: none;
    }

    .auth-main {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .model-grid {
        grid-template-columns: 1fr;
    }

    .doc-table {
        display: block;
        overflow-x: auto;
    }
}
