/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    overflow-x: hidden;
}

/* ==================== HEADER ==================== */
.header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 0.5rem;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    transition: background 0.2s;
}

.hamburger:hover {
    background: rgba(255,255,255,0.2);
}

.hamburger span {
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

.header-title {
    cursor: pointer;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-user span {
    font-size: 0.95rem;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* ==================== WELCOME BAR ==================== */
.welcome-bar {
    background: white;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.welcome-greeting {
    font-size: 1.1rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.welcome-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    font-size: 0.95rem;
    color: #6b7280;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-label {
    font-weight: 500;
    color: #374151;
}

.stat-value {
    color: #1f2937;
}

/* ==================== MAIN CONTAINER ==================== */
.main-container {
    display: flex;
    min-height: calc(100vh - 160px);
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 240px;
    background: white;
    border-right: 1px solid #e5e7eb;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-section {
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-header {
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
}

.sidebar-header:hover {
    background: #f9fafb;
}

.sidebar-header.collapsed::after {
    content: '▸';
    font-size: 0.9rem;
    color: #6b7280;
}

.sidebar-header.expanded::after {
    content: '▾';
    font-size: 0.9rem;
    color: #6b7280;
}

.sidebar-content {
    display: none;
    background: #fafafa;
}

.sidebar-content.show {
    display: block;
}

.sidebar-item {
    padding: 0.75rem 1.5rem 0.75rem 2.5rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
    position: relative;
}

.sidebar-item::before {
    content: '•';
    position: absolute;
    left: 1.75rem;
    color: #9ca3af;
}

.sidebar-item:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.sidebar-item.active {
    background: #eff6ff;
    color: #2563eb;
    border-left-color: #2563eb;
    font-weight: 500;
}

.sidebar-item.active::before {
    color: #2563eb;
}

/* ==================== CONTENT AREA ==================== */
.content-area {
    flex: 1;
    background: #fafafa;
    overflow: hidden;
}

/* ==================== LOADING STATE ==================== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    gap: 1rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== SPLIT LAYOUT ==================== */
.content-split {
    display: flex;
    width: 100%;
    gap: 1.5rem;
    padding: 1.5rem;
    min-height: 100%;
}

.content-left {
    flex: 0 0 40%;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.content-right {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

/* ==================== FULL WIDTH LAYOUT ==================== */
.content-full {
    width: 100%;
    padding: 1.5rem;
    min-height: 100%;
}

.content-full-inner {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ==================== CONTENT COMPONENTS ==================== */
.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

/* ==================== FORM ELEMENTS ==================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: #4b5563;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* ==================== RESULTS/OUTPUT COMPONENTS ==================== */
.result-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.result-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.metric-box {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #3b82f6;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.metric-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.list-styled {
    list-style: none;
    margin: 0;
    padding: 0;
}

.list-styled li {
    padding: 0.75rem 0;
    padding-left: 1.75rem;
    position: relative;
    color: #4b5563;
    line-height: 1.6;
}

.list-styled.success li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
    font-size: 1.1rem;
}

.list-styled.warning li::before {
    content: '⚠';
    position: absolute;
    left: 0;
    color: #f59e0b;
    font-size: 1.1rem;
}

/* ==================== CARD LIST ==================== */
.card-item {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-info h4 {
    color: #1f2937;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

.card-info p {
    color: #6b7280;
    font-size: 0.9rem;
}

.card-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid;
}

.btn-edit {
    background: white;
    color: #3b82f6;
    border-color: #3b82f6;
}

.btn-edit:hover {
    background: #eff6ff;
}

.btn-delete {
    background: white;
    color: #ef4444;
    border-color: #ef4444;
}

.btn-delete:hover {
    background: #fef2f2;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: #1f2937;
    margin-bottom: 0.5rem;
}

/* ==================== ERROR STATE ==================== */
.error-container {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    color: #991b1b;
}

.error-container h4 {
    margin-bottom: 0.5rem;
}

/* ==================== MOBILE OVERLAY ==================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
}

.sidebar-overlay.show {
    display: block;
}

/* ==================== MOBILE RESPONSIVE ==================== */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .header-title h1 {
        font-size: 1.2rem;
    }

    .header-user span {
        display: none;
    }

    .btn-logout {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .hamburger {
        display: flex;
    }

    .welcome-bar {
        padding: 1rem;
    }

    .welcome-greeting {
        font-size: 1rem;
    }

    .welcome-stats {
        gap: 1rem;
        font-size: 0.85rem;
    }

    .sidebar {
        position: fixed;
        left: -240px;
        top: 0;
        height: 100vh;
        z-index: 99;
        transition: left 0.3s;
        box-shadow: 2px 0 8px rgba(0,0,0,0.2);
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .content-split {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    .content-left, .content-right {
        flex: 1;
        max-height: none;
    }

    .content-full {
        padding: 1rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

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

    .card-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .card-actions {
        width: 100%;
        justify-content: stretch;
    }

    .card-actions .btn-small {
        flex: 1;
    }
}

/* ==================== UTILITY CLASSES ==================== */
.hidden {
    display: none;
}

.mb-1 {
    margin-bottom: 1rem;
}

.text-muted {
    color: #6b7280;
    font-size: 0.9rem;
}

/* ==================== MODAL STYLES ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-content form {
    padding: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}
