/* Table Of Stickys - Frontend Styles */

/* Reset and Base Styles */
.tos-widget-container * {
    box-sizing: border-box;
}

.tos-widget-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    position: relative;
    z-index: 999;
}

/* Sticky Navigation */
.tos-sticky-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    z-index: 1000;
    border-bottom: 4px solid transparent;
    border-image: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7, #dda0dd, #ff8c94) 1;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.tos-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

.tos-nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.tos-nav-logo {
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tos-nav-logo:hover {
    transform: scale(1.05);
}

/* Mobile inline reading indicator - DISABLED */
.tos-mobile-reading-inline {
    display: none !important;
}

.tos-highlight-orange {
    color: #ff8c00;
}

.tos-nav-menu {
    display: flex;
    list-style: none;
    gap: 0;
    margin: 0;
    padding: 0;
}

/* Mobile Tabs - Hidden on Desktop by default */
.tos-mobile-tabs {
    display: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: transparent;
    padding: 0;
    margin: 0;
    height: 60px;
    align-items: center;
}

.tos-mobile-tabs::-webkit-scrollbar {
    display: none;
}

/* Mobile Tab Items - Base Styles */
.tos-mobile-tab-item {
    flex: 1;
    min-width: 80px;
    max-width: 120px;
    margin: 0 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.tos-mobile-tab-item:first-child {
    margin-left: 0;
}

.tos-mobile-tab-item:last-child {
    margin-right: 0;
}

.tos-mobile-tab-link {
    display: block;
    padding: 12px 8px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tos-mobile-tab-link:hover {
    color: white;
    background: rgba(255, 140, 0, 0.2);
}

.tos-mobile-tab-link.active {
    background: rgba(255, 140, 0, 0.25) !important;
    color: #ff8c00 !important;
    font-weight: 600 !important;
    border-bottom: 3px solid #ff8c00 !important;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3) !important;
    transform: translateY(-1px) !important;
    position: relative !important;
}

.tos-mobile-tab-link.active::before {
    content: '●';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    color: #ff8c00;
    font-size: 0.5rem;
    animation: activePulse 2s infinite;
}

.tos-nav-item {
    position: relative;
}

.tos-nav-link {
    display: block;
    padding: 8px 20px 8px 20px; /* Adjusted padding for active indicator */
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.tos-nav-link:hover {
    background: rgba(255, 140, 0, 0.1);
    color: #ff8c00;
    transform: translateY(-1px);
}

.tos-nav-link.active {
    background: rgba(255, 140, 0, 0.25) !important;
    color: #ff8c00 !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3) !important;
    transform: translateY(-1px) !important;
    border: 1px solid rgba(255, 140, 0, 0.4) !important;
}

.tos-nav-link.active::after {
    content: '●';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff8c00;
    font-size: 0.6rem;
    animation: activePulse 2s infinite;
    z-index: 1;
}



@keyframes activePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.tos-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 140, 0, 0.2), transparent);
    transition: left 0.5s ease;
}

.tos-nav-link:hover::before {
    left: 100%;
}

/* Mobile Toggle - REMOVED (not needed) */

/* Mobile Menu - Simplified for better compatibility */
.tos-mobile-menu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    min-height: 200px;
}

.tos-mobile-menu.active {
    display: block !important;
}

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

.tos-mobile-nav-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.tos-mobile-nav-link {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.tos-mobile-nav-link:hover {
    background: rgba(255, 140, 0, 0.1);
    color: #ff8c00;
    padding-left: 30px;
}

.tos-mobile-nav-link.active {
    background: rgba(255, 140, 0, 0.15) !important;
    color: #ff8c00 !important;
    font-weight: 600 !important;
    padding-left: 30px !important;
    border-left: 4px solid #ff8c00 !important;
    position: relative !important;
}

.tos-mobile-nav-link.active::before {
    content: '📖';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    animation: readingBounce 1.5s infinite ease-in-out;
}

@keyframes readingBounce {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
}

/* Reading Progress */
.tos-reading-progress-container {
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.tos-reading-progress {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1);
    width: 0%;
    transition: width 0.3s ease;
}

/* Progress Circle */
.tos-progress-circle {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1001;
}

.tos-progress-circle svg {
    position: absolute;
    transform: rotate(-90deg);
}

.tos-progress-circle .tos-progress-bg {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 3;
}

.tos-progress-circle .tos-progress-fill {
    fill: none;
    stroke: #ff8c00;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 113;
    stroke-dashoffset: 113;
    transition: stroke-dashoffset 0.3s ease;
}

.tos-progress-text {
    font-size: 10px;
    font-weight: bold;
    color: #333;
}

/* Current Reading Indicator - REMOVED (not needed) */

/* Style variations - REMOVED (not needed) */

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

@keyframes readingPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes readingBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.1); }
}

/* Currently Reading - REMOVED (not needed) */

/* FORCE ACTIVE LINK STYLES - Immediate effect without resize */
.tos-nav-link[data-active="true"],
.tos-nav-link.active,
.tos-mobile-nav-link[data-active="true"],
.tos-mobile-nav-link.active {
    background: rgba(255, 140, 0, 0.25) !important;
    color: #ff8c00 !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.3) !important;
    transform: translateY(-1px) !important;
    border-left: 3px solid #ff8c00 !important;
}

.tos-reading-text {
    font-size: 0.85rem;
    color: inherit;
}

/* Theme Switcher */
.tos-theme-switcher {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.tos-theme-switcher:hover {
    background: rgba(255, 140, 0, 0.1);
    transform: rotate(15deg);
}

/* Dark Theme */
.tos-widget-container[data-theme="dark"] .tos-sticky-nav {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.tos-widget-container[data-theme="dark"] .tos-mobile-menu {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.tos-widget-container[data-theme="dark"] .tos-current-reading {
    background: rgba(30, 30, 30, 0.95);
    color: #ff8c00;
    border: 1px solid rgba(255, 140, 0, 0.3);
}

.tos-widget-container[data-theme="dark"] .tos-reading-text {
    color: #ff8c00;
}

.tos-widget-container[data-theme="dark"] .tos-mobile-only {
    background: rgba(255, 140, 0, 0.9);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Performance Optimizations */
.tos-nav-link,
.tos-mobile-nav-link,
.tos-mobile-toggle,
.tos-theme-switcher {
    will-change: transform;
}

.tos-reading-progress {
    will-change: width;
}

/* Accessibility */
.tos-nav-link:focus,
.tos-mobile-nav-link:focus,
.tos-mobile-toggle:focus,
.tos-theme-switcher:focus {
    outline: 2px solid #ff8c00;
    outline-offset: 2px;
}

/* Responsive Breakpoints - Force mobile layout */
@media (max-width: 968px) {
    .tos-nav-menu {
        display: none !important;
    }

    /* Mobile toggle removed - not needed */

    /* NEW: Mobile Horizontal Tabs Layout */
    .tos-mobile-tabs {
        display: flex !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
        background: transparent;
        padding: 0;
        margin: 0;
        height: 60px;
        align-items: center;
        width: 100%;
    }

    .tos-mobile-tabs::-webkit-scrollbar {
        display: none; /* Hide scrollbar on WebKit browsers */
    }

    .tos-nav-logo {
        font-size: 1.1rem;
    }

    .tos-nav-content {
        height: 60px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0;
    }

    .tos-nav-content .tos-nav-logo {
        display: none; /* Hide logo on mobile to save space */
    }

    /* FORCE mobile tabs to be visible */
    .tos-mobile-tabs {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
        z-index: 999 !important;
    }

    /* Currently Reading removed - not needed */

    .tos-progress-circle {
        top: 70px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
    
    /* Hide old mobile menu for tab layout */
    .tos-mobile-menu {
        display: none !important;
    }
    
    .tos-mobile-menu.active {
        display: none !important;
    }
}

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

@keyframes mobileReadingPulse {
    0%, 100% { opacity: 0.8; transform: scale(1) rotate(0deg); }
    33% { opacity: 1; transform: scale(1.1) rotate(2deg); }
    66% { opacity: 0.9; transform: scale(1.05) rotate(-1deg); }
}

@media (max-width: 480px) {
    .tos-nav-container {
        padding: 0 15px;
    }

    .tos-nav-logo {
        font-size: 1rem;
    }

    .tos-current-reading {
        right: 10px;
        font-size: 0.8rem;
    }

    .tos-progress-circle {
        right: 10px;
        width: 35px;
        height: 35px;
    }

    .tos-progress-text {
        font-size: 8px;
    }
}

/* Animation for smooth loading */
.tos-widget-container {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Currently Reading Update Animations */
.tos-current-reading.reading-update {
    animation: readingUpdatePulse 0.6s ease;
}

.tos-current-reading.mobile-reading-update {
    animation: mobileReadingVibrate 0.8s ease;
}

.tos-mobile-reading-inline.mobile-reading-update {
    animation: mobileInlineUpdate 0.6s ease;
}

@keyframes readingUpdatePulse {
    0% { transform: scale(1); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); }
    25% { transform: scale(1.05); box-shadow: 0 6px 25px rgba(255, 140, 0, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 8px 30px rgba(255, 140, 0, 0.5); }
    75% { transform: scale(1.05); box-shadow: 0 6px 25px rgba(255, 140, 0, 0.3); }
    100% { transform: scale(1); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); }
}

@keyframes mobileReadingVibrate {
    0% { transform: translateX(0) scale(1); }
    10% { transform: translateX(-2px) scale(1.02); }
    20% { transform: translateX(2px) scale(1.05); }
    30% { transform: translateX(-2px) scale(1.02); }
    40% { transform: translateX(2px) scale(1.05); }
    50% { transform: translateX(-1px) scale(1.1); }
    60% { transform: translateX(1px) scale(1.05); }
    70% { transform: translateX(-1px) scale(1.02); }
    80% { transform: translateX(1px) scale(1.01); }
    90% { transform: translateX(-0.5px) scale(1.005); }
    100% { transform: translateX(0) scale(1); }
}

@keyframes mobileInlineUpdate {
    0% { color: #ff8c00; font-weight: 300; }
    25% { color: #fff; font-weight: 500; transform: scale(1.05); }
    50% { color: #ff8c00; font-weight: 600; transform: scale(1.1); }
    75% { color: #fff; font-weight: 500; transform: scale(1.05); }
    100% { color: #ff8c00; font-weight: 300; transform: scale(1); }
}

/* Improved visibility states */
.tos-current-reading.visible {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    animation: slideInFromCorner 0.4s ease-out;
}

.tos-current-reading.active {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* Force minimal dot visibility */
.tos-reading-dot.active {
    opacity: 1 !important;
    visibility: visible !important;
    animation: readingPulse 2s infinite !important;
}

@keyframes slideInFromCorner {
    from {
        opacity: 0;
        transform: translate(20px, -20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
}

/* Intersection Observer Enhancements */
.tos-nav-link[data-in-view="true"] {
    background: rgba(255, 140, 0, 0.15);
    color: #ff8c00;
}

/* Print Styles */
@media print {
    .tos-sticky-nav,
    .tos-current-reading,
    .tos-progress-circle {
        display: none !important;
    }
} 