/* 
 * TAMASH Training Portal - Core Design System 
 * Standards: WCAG 2.1 AA Compliant, Modern Premium Aesthetic
 */

:root {
    /* Color Palette - Accessible Contrast Ratios */
    --p-600: #4f46e5; /* Primary */
    --p-700: #4338ca;
    --p-100: #e0e7ff;
    
    --s-600: #0d9488; /* Secondary */
    --s-700: #0f766e;
    
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-on-dark: #f8fafc;

    --border: #e2e8f0;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);

    --sidebar-width: 280px;
    --header-height: 70px;
}

[data-theme="dark"] {
    --bg-main: #020617;
    --bg-card: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

/* Base Accessibility Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.5;
}

/* Keyboard Accessibility - Visible Focus States */
:focus-visible {
    outline: 3px solid var(--p-600);
    outline-offset: 2px;
}

/* Layout Framework */
.portal-container {
    display: flex;
    min-height: 100vh;
}

/* Accessible Sidebar Navigation */
.portal-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--p-600), var(--s-600));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
    font-size: 1.2rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-group {
    margin-bottom: 2rem;
}

.nav-label {
    padding: 0 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-link.active {
    background: var(--p-600);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Main Content Area */
.portal-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.portal-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 900;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
}

.feature-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

/* Accessibility: Button focus and sizing */
.btn-portal {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px; /* Touch target size */
}

/* Screen Reader Only Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Mobile Toggle Button */
.mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--p-600);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.mobile-toggle:hover {
    background: var(--p-700);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

@media (max-width: 1024px) {
    .mobile-toggle {
        display: flex;
    }

    .portal-sidebar {
        transform: translateX(-100%);
    }
    .portal-main {
        margin-left: 0;
    }
    .portal-sidebar.open {
        transform: translateX(0);
    }

    .portal-header {
        padding: 0 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
}
