/* Mobile-First Components - Full Screen Utilization */

/* MOBILE STICKY NAVIGATION */
.mobile-sticky-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 16px;
}

.mobile-nav-container {
    position: relative;
}

.mobile-nav-toggle {
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s ease;
    width: 100%;
    justify-content: space-between;
}

.mobile-nav-toggle:active {
    background: rgba(0, 122, 255, 0.1);
}

.nav-icon {
    font-size: 16px;
}

.nav-text {
    font-weight: 500;
    flex: 1;
    text-align: left;
}

.nav-chevron {
    font-size: 12px;
    transition: transform 0.2s ease;
    color: #666;
}

.mobile-nav-toggle.active .nav-chevron {
    transform: rotate(180deg);
}

.mobile-nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 4px;
}

.mobile-nav-dropdown.open {
    max-height: 350px;
}

.mobile-nav-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s ease;
}

.mobile-nav-item:last-child {
    border-bottom: none;
}

.mobile-nav-item:active {
    background: rgba(0, 122, 255, 0.1);
}

.mobile-nav-item.active {
    background: #007AFF;
    color: white;
}

/* Show mobile sticky nav only on mobile and when scrolled */
@media (max-width: 767px) {
    .mobile-sticky-nav.show {
        display: block;
    }
    
    /* Add padding to body when sticky nav is active */
    body.sticky-nav-active {
        padding-top: 50px;
    }
}

/* HEADER - Full width, minimal padding */
.header {
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.professional-banner {
    background: #007AFF;
    color: white;
    padding: 12px 16px;
    text-align: center;
    font-size: 14px;
}

.creation-date {
    display: block;
    font-weight: 500;
}

.header-content {
    padding: 20px 16px;
}

.title-section {
    text-align: center;
}

.title-section h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.subtitle {
    font-size: 1rem;
    color: #666;
    margin-bottom: 20px;
}

/* Meta information - Stack on mobile */
.meta-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 8px;
}

.meta-item strong {
    font-size: 14px;
    color: #333;
}

.meta-item span {
    font-size: 13px;
    color: #666;
}

/* Summary box - Full width on mobile */
.what-this-is {
    margin: 20px 0;
    padding: 20px 16px;
    background: #f0f7ff;
    border-left: 4px solid #007AFF;
}

.what-this-is h4 {
    margin-bottom: 12px;
    color: #0051D5;
}

.summary-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.summary-item {
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.summary-item h4 {
    font-size: 1rem;
    margin-bottom: 12px;
    text-align: left;
}

.summary-item ul {
    margin: 0;
    padding-left: 20px;
    text-align: left;
}

.summary-item li {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 6px;
}

/* NAVIGATION - Full width grid */
.navigation {
    background: #f8f8f8;
    padding: 16px;
    border-bottom: 1px solid #eee;
}

.nav-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.nav-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
}

.nav-item:active {
    background: #f0f0f0;
    transform: scale(0.98);
}

.nav-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.chapter-badge {
    background: #007AFF;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.nav-item h4 {
    font-size: 1rem;
    margin: 0;
    color: #111;
    flex: 1;
}

.nav-item p {
    font-size: 14px;
    color: #666;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.nav-item p:last-child {
    font-size: 13px;
    color: #007AFF;
    font-style: italic;
    margin: 8px 0 0 0;
}

/* CHAPTERS - Full width sections */
.chapter {
    padding: 24px 16px;
    border-bottom: 1px solid #eee;
    background: white;
}

.chapter-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.chapter-number {
    background: #007AFF;
    color: white;
    font-size: 14px;
    font-weight: 700;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chapter-title {
    font-size: 1.25rem;
    margin: 0;
    flex: 1;
}

/* CONTENT BOXES - Full width, minimal margins */
.teacher-tip {
    background: #fff9e6;
    border-left: 4px solid #ffb700;
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

.simple-explanation {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

.key-takeaway {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

.warning-box {
    background: #ffebee;
    border-left: 4px solid #f44336;
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

.interactive-demo {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    padding: 16px;
    margin: 16px 0;
    border-radius: 8px;
}

.demo-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.demo-output {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    margin-top: 12px;
    min-height: 40px;
    font-size: 14px;
}

/* INTERACTIVE ELEMENTS */
.token-box {
    display: inline-block;
    padding: 8px 12px;
    margin: 4px;
    background: #e3f2fd;
    border: 1px solid #2196f3;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1976d2;
    user-select: none;
}

/* Pattern options container default gap */
#patternOptions {
    gap: 12px;
}

.token-box:active {
    transform: scale(0.95);
    background: #bbdefb;
}

.pattern-guess, .quiz-option {
    background: #007AFF;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    margin: 8px 0;
    transition: all 0.2s ease;
    display: block;
    width: 100%;
    text-align: center;
}

.pattern-guess:active, .quiz-option:active {
    transform: scale(0.98);
    background: #0051D5;
}

/* SCENARIO SIMULATOR */
#scenarioSimulator {
    padding: 16px 0;
}

#scenarioDescription {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.6;
}

#scenarioChoices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scenario-choice {
    width: 100%;
    text-align: left !important;
    padding: 16px !important;
    font-size: 15px !important;
}

/* FOOTER */
.professional-footer {
    background: #f8f8f8;
    padding: 24px 16px;
    margin-top: 40px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.footer-bottom p {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
}

/* Progressive Enhancement: 375px+ */
@media (min-width: 375px) {
    .header-content {
        padding: 24px 20px;
    }
    
    .title-section h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.125rem;
    }
    
    .nav-item {
        padding: 20px;
    }
    
    .chapter {
        padding: 32px 20px;
    }
}

/* Progressive Enhancement: 480px+ */
@media (min-width: 480px) {
    .meta-grid {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .meta-item {
        flex: 1;
        min-width: 140px;
        max-width: 200px;
    }
    
    .pattern-guess, .quiz-option {
        display: inline-block;
        width: auto;
        min-width: 160px;
        margin: 8px 4px;
    }
    
    .token-box {
        padding: 10px 16px;
        margin: 6px;
        font-size: 15px;
    }
}

/* Progressive Enhancement: 768px+ (Tablets) */
@media (min-width: 768px) {
    .header {
        margin: 20px auto;
        max-width: 100%;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .professional-banner {
        padding: 16px 24px;
        font-size: 15px;
        border-radius: 12px 12px 0 0;
    }
    
    .header-content {
        padding: 40px 32px;
    }
    
    .title-section h1 {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.25rem;
    }
    
    .nav-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
        max-width: 900px;
        margin: 0 auto;
    }
    
    .nav-item {
        padding: 24px;
    }
    
    .nav-item:hover {
        background: #f8f8f8;
        border-color: #007AFF;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
    }
    
    .chapter {
        max-width: 800px;
        margin: 32px auto;
        padding: 40px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .chapter-header {
        gap: 20px;
    }
    
    .chapter-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .chapter-title {
        font-size: 1.5rem;
    }
    
    .summary-grid {
        flex-direction: row;
        gap: 24px;
    }
    
    .summary-item {
        flex: 1;
    }
    
    .teacher-tip, .simple-explanation, .key-takeaway, .warning-box, .interactive-demo {
        margin: 24px auto;
        padding: 24px;
        max-width: 700px;
    }
    
    .token-box:hover {
        transform: scale(1.05);
        box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
    }
    
    .pattern-guess:hover, .quiz-option:hover {
        background: #0051D5;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    }
    
    /* Pattern Recognition Challenge specific spacing for desktop */
    #patternOptions {
        gap: 20px !important;
        padding: 10px;
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 500px;
        margin-left: auto;
        margin-right: auto;
    }
    
    #patternOptions .pattern-guess {
        margin: 0;
        padding: 14px 24px;
        min-width: 180px;
        width: 100%;
    }
}

/* Progressive Enhancement: 1024px+ (Desktop) */
@media (min-width: 1024px) {
    .header {
        max-width: 1000px;
    }
    
    .header-content {
        padding: 48px 40px;
    }
    
    .title-section h1 {
        font-size: 3rem;
    }
    
    .subtitle {
        font-size: 1.5rem;
    }
    
    .navigation {
        max-width: 1000px;
        margin: 32px auto;
        padding: 32px;
        border-radius: 12px;
    }
    
    .nav-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        max-width: 1000px;
    }
    
    .chapter {
        max-width: 900px;
        padding: 48px;
    }
    
    .chapter-number {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .chapter-title {
        font-size: 1.75rem;
    }
    
    /* Even more spacing for Pattern Recognition Challenge on larger screens */
    #patternOptions {
        gap: 25px !important;
        padding: 15px;
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 600px;
    }
    
    #patternOptions .pattern-guess {
        padding: 16px 28px;
        min-width: 200px;
        width: 100%;
    }
}

/* Progressive Enhancement: 1440px+ (Large Desktop) */
@media (min-width: 1440px) {
    .header {
        max-width: 1200px;
    }
    
    .navigation {
        max-width: 1200px;
    }
    
    .nav-grid {
        max-width: 1200px;
    }
    
    .chapter {
        max-width: 1000px;
    }
    
    .title-section h1 {
        font-size: 3.5rem;
    }
}

/* Touch optimizations */
@media (hover: none) and (pointer: coarse) {
    .nav-item:hover {
        background: white;
        border-color: #e0e0e0;
        transform: none;
        box-shadow: none;
    }
    
    .token-box:hover {
        transform: none;
        box-shadow: none;
    }
    
    button:hover, .btn:hover,
    .pattern-guess:hover, .quiz-option:hover {
        background: #007AFF;
        transform: none;
        box-shadow: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Mobile sticky nav dark mode */
    .mobile-sticky-nav {
        background: rgba(26, 26, 26, 0.95);
        border-bottom-color: #333;
    }
    
    .mobile-nav-toggle {
        color: #fff;
    }
    
    .mobile-nav-toggle:active {
        background: rgba(10, 132, 255, 0.2);
    }
    
    .nav-chevron {
        color: #ccc;
    }
    
    .mobile-nav-dropdown {
        background: #1a1a1a;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }
    
    .mobile-nav-item {
        color: #fff;
        border-bottom-color: #333;
    }
    
    .mobile-nav-item:active {
        background: rgba(10, 132, 255, 0.2);
    }
    
    .mobile-nav-item.active {
        background: #0A84FF;
    }
    
    .header {
        background: #1a1a1a;
        border-bottom-color: #333;
    }
    
    .professional-banner {
        background: #0A84FF;
    }
    
    .header-content {
        background: #1a1a1a;
    }
    
    .subtitle {
        color: #ccc;
    }
    
    .meta-item {
        background: #2a2a2a;
        color: #fff;
    }
    
    .meta-item strong {
        color: #fff;
    }
    
    .meta-item span {
        color: #ccc;
    }
    
    .what-this-is {
        background: #1a2332;
        border-left-color: #0A84FF;
        color: #fff;
    }
    
    .summary-item {
        background: #2a2a2a;
        color: #fff;
    }
    
    .navigation {
        background: #1a1a1a;
        border-bottom-color: #333;
    }
    
    .nav-item {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .nav-item h4 {
        color: #fff;
    }
    
    .nav-item p {
        color: #ccc;
    }
    
    .nav-item p:last-child {
        color: #0A84FF;
    }
    
    .chapter {
        background: #1a1a1a;
        color: #fff;
        border-bottom-color: #333;
    }
    
    .chapter-header {
        border-bottom-color: #333;
    }
    
    .chapter-title {
        color: #fff;
    }
    
    .teacher-tip {
        background: #332a00;
        color: #fff;
    }
    
    .simple-explanation {
        background: #1a3a1a;
        color: #fff;
    }
    
    .key-takeaway {
        background: #1a2a3a;
        color: #fff;
    }
    
    .warning-box {
        background: #3a1a1a;
        color: #fff;
    }
    
    .interactive-demo {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .demo-output {
        background: #1a1a1a;
        border-color: #444;
        color: #fff;
    }
    
    .token-box {
        background: #1a2a3a;
        border-color: #0A84FF;
        color: #0A84FF;
    }
    
    .professional-footer {
        background: #1a1a1a;
        border-top-color: #333;
    }
    
    .footer-bottom p {
        color: #ccc;
    }
}