/* ============================================
   Reset & Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* AWS Color Palette */
    --primary-color: #FF9900;
    --primary-dark: #EC7211;
    --primary-light: #FFAC31;
    --aws-squid-ink: #232F3E;
    --aws-dark: #161E2D;

    /* UI Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --success: #28a745;
    --info: #17a2b8;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Sidebar */
    --sidebar-width: 360px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   Login Screen
   ============================================ */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, var(--aws-squid-ink) 0%, #1a2332 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-container {
    background: white;
    padding: 3rem 2.5rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.5s ease-out;
}

.login-icon {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.login-icon svg {
    filter: drop-shadow(0 4px 8px rgba(255, 153, 0, 0.3));
}

.login-container h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-container>p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.pin-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#pin-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.25rem;
    text-align: center;
    letter-spacing: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
    font-weight: 600;
}

#pin-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.1);
}

.btn-login {
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s;
}

.btn-login:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 153, 0, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    min-height: 20px;
    margin-top: 0.5rem;
    font-weight: 500;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.shake,
#pin-input.shake {
    animation: shake 0.4s ease-in-out;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ============================================
   Header
   ============================================ */
.header {
    background: linear-gradient(135deg, var(--aws-squid-ink) 0%, #1a2332 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--primary-color);
}

.header-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--spacing-md);
}

.mobile-menu-btn {
    display: none;
    background: rgba(255, 153, 0, 0.1);
    border: 1px solid rgba(255, 153, 0, 0.3);
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    background: rgba(255, 153, 0, 0.2);
    border-color: var(--primary-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo svg {
    filter: drop-shadow(0 2px 4px rgba(255, 153, 0, 0.3));
    transition: transform 0.3s ease;
}

.logo:hover svg {
    transform: scale(1.05) rotate(5deg);
}

.logo h1 {
    font-size: 1.375rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(90deg, #fff 0%, #e0e0e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    justify-self: end;
}

.progress-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#overall-progress {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color) 0%, #ffcc66 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* ============================================
   Buttons
   ============================================ */
.btn-outline {
    padding: 0.5rem 1.125rem;
    border: 1.5px solid var(--primary-color);
    background: rgba(255, 153, 0, 0.05);
    color: var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-outline::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--primary-color);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
    z-index: -1;
}

.btn-outline:hover::before {
    width: 300px;
    height: 300px;
}

.btn-outline:hover {
    color: white;
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 153, 0, 0.3);
}

.btn-secondary {
    padding: 0.5rem 1rem;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary.completed {
    background: var(--text-muted);
    cursor: default;
}

.btn-secondary.completed:hover {
    transform: none;
    box-shadow: none;
}

/* ============================================
   Sidebar Backdrop
   ============================================ */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 88px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-backdrop.active {
    opacity: 1;
}

/* ============================================
   Main Layout
   ============================================ */
.main-container {
    display: flex;
    min-height: calc(100vh - 88px);
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    position: sticky;
    top: 88px;
    height: calc(100vh - 88px);
    transition: transform 0.3s;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.sidebar-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.toggle-sidebar {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    color: var(--text-secondary);
    display: none;
}

.toggle-sidebar:hover {
    background: var(--bg-tertiary);
}

.sections-list {
    padding: var(--spacing-sm);
}

.section {
    margin-bottom: var(--spacing-sm);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: white;
}

.section-header {
    padding: var(--spacing-md);
    cursor: pointer;
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.section-header:hover {
    background: var(--bg-tertiary);
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.section-progress {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.lessons-list {
    display: none;
    background: white;
}

.section.expanded .lessons-list {
    display: block;
}

.lesson-item {
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.lesson-item:hover {
    background: var(--bg-secondary);
    border-left-color: var(--primary-color);
}

.lesson-item.active {
    background: #FFF5E6;
    border-left-color: var(--primary-color);
}

.lesson-item.completed {
    opacity: 0.7;
}

.lesson-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lesson-item.completed .lesson-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.lesson-checkbox svg {
    display: none;
    width: 14px;
    height: 14px;
    stroke: white;
}

.lesson-item.completed .lesson-checkbox svg {
    display: block;
}

.lesson-name {
    font-size: 0.875rem;
    color: var(--text-primary);
    flex: 1;
}

.lesson-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Content Area
   ============================================ */
.content-area {
    flex: 1;
    background: var(--bg-secondary);
}

/* ============================================
   Welcome Screen
   ============================================ */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 88px);
    padding: var(--spacing-xl);
}

.welcome-content {
    text-align: center;
    max-width: 600px;
}

.welcome-icon {
    margin-bottom: var(--spacing-lg);
}

.welcome-content h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.welcome-content p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
}

.course-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.stat-card {
    background: white;
    padding: var(--spacing-lg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   Player Container
   ============================================ */
.player-container {
    padding: var(--spacing-md);
    max-width: 1400px;
    margin: 0 auto;
}

.video-player-card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: var(--spacing-md);
}

.lesson-header {
    background: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
}

.lesson-info {
    flex: 1;
}

.breadcrumb {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    display: block;
}

.lesson-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.lesson-controls {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.control-btn {
    height: 38px;
    padding: 0 0.875rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    transition: all 0.2s;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.control-btn svg {
    flex-shrink: 0;
}

.control-btn:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

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

.control-btn-complete:hover:not(.completed) {
    background: #218838;
    border-color: #218838;
}

.control-btn-complete.completed {
    background: var(--text-muted);
    border-color: var(--text-muted);
    cursor: default;
}

.control-btn-complete.completed:hover {
    transform: none;
    box-shadow: none;
}

/* ============================================
   Video Player
   ============================================ */
.video-wrapper {
    background: black;
    overflow: hidden;
    position: relative;
}

#video-player {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16/9;
    max-height: 70vh;
}


/* ============================================
   Resources Section
   ============================================ */
.resources-section {
    background: white;
    padding: var(--spacing-lg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.resources-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

.resources-list {
    display: grid;
    gap: var(--spacing-sm);
}

.resource-item {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.resource-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.resource-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 320px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 0;
    }

    .sidebar-backdrop.active {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 88px;
        z-index: 50;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .toggle-sidebar {
        display: block;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .header-content {
        grid-template-columns: auto 1fr;
        gap: var(--spacing-sm);
    }

    .header-actions {
        grid-column: 1 / -1;
        justify-self: stretch;
        justify-content: space-between;
        gap: var(--spacing-sm);
    }

    .logo h1 {
        font-size: 1rem;
    }

    .logo svg {
        width: 32px;
        height: 32px;
    }

    .progress-indicator {
        flex: 1;
        justify-content: center;
    }

    #overall-progress {
        font-size: 1.5rem;
    }

    .btn-outline {
        padding: 0.4rem 0.875rem;
        font-size: 0.8rem;
    }

    .course-stats {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .stat-card {
        padding: var(--spacing-md);
    }

    .lesson-header {
        padding: var(--spacing-sm);
        gap: var(--spacing-sm);
    }

    .breadcrumb {
        font-size: 0.7rem;
    }

    .lesson-title {
        font-size: 0.95rem;
    }

    .lesson-controls {
        gap: 0.375rem;
    }

    .control-btn {
        height: 34px;
        padding: 0 0.625rem;
        font-size: 0.8rem;
    }

    .control-btn svg {
        width: 16px;
        height: 16px;
    }

    .player-container {
        padding: var(--spacing-xs);
    }

    #video-player {
        max-height: 50vh;
    }

    .resources-section {
        padding: var(--spacing-sm);
    }

    .resources-section h3 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 2rem 1.5rem;
    }
    
    .login-container h2 {
        font-size: 1.5rem;
    }
    
    .login-icon svg {
        width: 60px;
        height: 60px;
    }
    
    #pin-input {
        font-size: 1.125rem;
        padding: 0.875rem;
    }
    
    .header {
        padding: 0.625rem 0;
    }
    
    .header-content {
        gap: 0.5rem;
    }
    
    .logo h1 {
        font-size: 0.875rem;
    }
    
    .logo svg {
        width: 28px;
        height: 28px;
    }
    
    .progress-indicator {
        padding: 0.375rem 0.75rem;
    }
    
    #overall-progress {
        font-size: 1.25rem;
    }
    
    .progress-label {
        font-size: 0.75rem;
    }
    
    .btn-outline {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    .lesson-title {
        font-size: 0.875rem;
    }

    .lesson-controls {
        gap: 0.25rem;
    }

    .control-btn {
        height: 32px;
        padding: 0 0.5rem;
        font-size: 0.75rem;
    }

    .control-btn span {
        display: none;
    }

    .control-btn {
        padding: 0;
        width: 32px;
    }

    .control-btn svg {
        width: 16px;
        height: 16px;
    }

    .welcome-content h2 {
        font-size: 1.5rem;
    }

    .stat-number {
        font-size: 2rem;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    animation: slideDown 0.5s ease-out;
}

.section {
    animation: fadeIn 0.3s ease-out;
}

.progress-indicator {
    animation: fadeIn 0.5s ease-out 0.2s both;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {

    .sidebar,
    .header-actions,
    .lesson-navigation,
    .lesson-actions {
        display: none;
    }
}