/* Custom CSS for K-8 Worksheet Project */

/* From header.php */
html, body {
    overflow-x: hidden;
    width: 100%;
}
body {
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
/* Navbar Toggler Customization (No Frame) */
.navbar-toggler {
    border: none !important;
    padding: 0;
}
.navbar-toggler:focus {
    box-shadow: none !important;
    outline: none !important;
}

/* From admin/index.php */
.hover-card {
    cursor: pointer;
}
.icon-box {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

/* From admin/login.php */
.login-wrapper {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    width: 100%;
    max-width: 400px;
}

/* From view.php */
.viewer-container {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}
.viewer-header {
    background: #fff;
    padding: 10px 15px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    overflow: hidden;
}
.title-group {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    margin-right: 15px;
    position: relative;
    min-width: 0;
    max-width: 100%;
}
.nav-group {
    flex-shrink: 0;
}
@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.marquee-active {
    display: inline-block;
    animation: marquee 10s linear infinite;
    /* Pause on hover for readability */
}
.marquee-active:hover {
    animation-play-state: paused;
}
.viewer-body {
    background: #333;
    padding: 0;
    text-align: center;
    width: 100%;
    height: 50vh;
    min-height: 600px;
    position: relative;
    overflow: hidden;
}
.viewer-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}
.viewer-footer {
    background: #fff;
    padding: 0;
    border-top: 1px solid #dee2e6;
}
.action-btn {
    border-radius: 0;
    padding: 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    transition: all 0.2s;
}
.btn-download-action {
    background-color: #0d6efd;
    color: white;
}
.btn-download-action:hover {
    background-color: #0b5ed7;
    color: white;
}
.btn-share-action {
    background-color: #6c757d;
    color: white;
}
.btn-share-action:hover {
    background-color: #5c636a;
    color: white;
}
.btn-favorite-action {
    background-color: #ffc107;
    color: #000;
}
.btn-favorite-action:hover {
    background-color: #ffca2c;
    color: #000;
}
.nav-btn {
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 5px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}
.nav-btn:hover {
    background-color: #f8f9fa;
    color: #000;
}
.nav-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}
.file-badge {
    background-color: #198754;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-left: 8px;
}
@media (max-width: 992px) {
    .viewer-body {
        height: 60vh;
        min-height: 350px;
    }
    .viewer-header {
        flex-direction: row; 
        gap: 10px;
    }
    .btn-text {
        display: none;
    }
}

/* From index.php */
.hero-section {
    background: linear-gradient(135deg, #4da9ff, #0d6efd);
    color: white;
    padding: 2.5rem 0;
    text-align: center;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}
@media (max-width: 576px) {
    .hero-section {
        padding: 1.5rem 0;
    }
}
@media (max-width: 991.98px) {
    .sidebar-col {
        width: 100% !important;
    }
}
.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}
.search-input {
    border-radius: 50px;
    padding: 12px 50px 12px 25px;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    font-size: 1rem;
    height: 55px;
}
.search-input:focus {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.search-btn {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 43px;
    height: 43px;
    border-radius: 50%;
    border: none;
    background: #0d6efd;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    cursor: pointer;
}
.search-btn:hover {
    background: #0b5ed7;
}
.search-spinner {
    position: absolute;
    right: 15px;
    top: 18px;
    display: none;
}

/* Sidebar Customization */
.sidebar-col {
    width: 350px;
    max-width: 100%;
}
.file-results-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075);
}
.file-results-header {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f3f5;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Sidebar Cards to match Results Card */
.sidebar-col .card,
.view-content-card {
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important;
    border-radius: 8px !important;
}
.sidebar-col .card-header,
.view-content-card .card-header {
    padding: 15px 20px !important;
    border-bottom: 1px solid #f1f3f5 !important;
    background: #fff !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.file-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 5px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}
.file-list-row:last-child {
    border-bottom: none;
}
.file-list-row:hover {
    background-color: #f8f9fa;
}

.file-row-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.file-row-icon {
    font-size: 1.5rem;
    margin-right: 15px;
    width: 40px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}
.file-row-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
}
.file-row-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 10px;
}
.stat-pill {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.75rem;
    color: #6c757d;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Level Cards (Homepage) */
.level-card {
    background: #fff;
    border: 1px solid #eef2f6;
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
}
.level-card-header {
    background: #fff;
    padding: 15px 15px;
    border-bottom: 1px solid #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.level-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #343a40;
    display: flex;
    align-items: center;
}
.file-count-badge {
    background: #f8f9fa;
    border: 1px solid #e9ecef; /* Add border for definition */
    color: #6c757d; /* Darker grey */
    font-size: 0.85rem; /* Larger font */
    padding: 6px 12px; /* More padding */
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}
.level-body {
    padding: 0;
}
.year-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.year-item {
    position: relative;
    padding: 10px 12px;
    border-bottom: 1px solid #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Ensure spacing between name and badge */
    transition: background 0.2s;
}
.year-item:last-child {
    border-bottom: none;
}
.year-item:hover {
    background: #f8f9fa;
}
.year-icon {
    font-size: 1.2rem;
    width: 32px;
    color: #0d6efd; /* Blue icon */
    opacity: 1; /* Full opacity */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}
.year-name {
    flex: 1;
    color: #495057;
    font-weight: 500;
    text-decoration: none; /* Ensure no underline */
}
.year-count-badge {
    background: #0d6efd; /* Blue background */
    color: #fff; /* White text */
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px; /* Pill shape */
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* Timer Button Styles */
.timer-mode {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
    pointer-events: none;
    cursor: not-allowed;
    border: 1px solid #dee2e6;
}

.timer-border-animation {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, #0d6efd, #6610f2, #0d6efd);
    background-size: 200% 100%;
    animation: gradientMove 1.5s linear infinite;
}

@keyframes gradientMove {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Hourglass Animation */
#timer-content .bi-hourglass-split {
    display: inline-block;
    animation: hourglassSpin 3s infinite ease-in-out;
}

@keyframes hourglassSpin {
    0% { transform: rotate(0deg); }
    40% { transform: rotate(180deg); }
    50% { transform: rotate(180deg); }
    90% { transform: rotate(360deg); }
    100% { transform: rotate(360deg); }
}
