@import '_variables.css';
@import '_reset.css';
@import '_typography.css';
@import '_components.css';

/* ==========================================================================
   4. LAYOUT & GRID
   ========================================================================== */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    width: 100%;
}



/* --- File Items --- */
.file-item {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    box-sizing: border-box;
    cursor: pointer;
}

.file-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.file-item:nth-child(odd) {
    background-color: var(--background-color);
}

.file-item:nth-child(even) {
    background-color: rgba(243, 244, 246, 0.5);
}

.file-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.file-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.button-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-shrink: 0;
}

/* Style overrides for material items to ensure full visibility of file names */
.file-item .file-content {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.file-item .file-content .file-name {
    width: 100%;
    max-width: 100%;
    display: block;
    word-break: break-word;
    word-wrap: break-word;
    white-space: normal;
    overflow: hidden;
    padding-right: 5px;
}

/* --- Search Results --- */
.file-item.search-match {
    background-color: rgba(37, 99, 235, 0.05);
    border: 1px solid var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.15);
    position: relative;
}

.search-match .file-name {
    font-weight: 600;
    color: var(--primary-color);
}

.search-highlight {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--text-color);
    font-weight: 600;
    padding: 0 2px;
    border-radius: 3px;
    box-shadow: none;
    position: relative;
    display: inline-block;
}

.search-results-summary {
    background-color: var(--white);
    padding: 0.8rem 1.5rem;
    margin: 1rem 0 1.5rem 0;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.search-results-summary .count {
    font-weight: 600;
    color: var(--primary-color);
}

.clear-search {
    background-color: var(--white);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    font-weight: 500;
}

.clear-search:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.has-search-results .section-header {
    background-color: var(--primary-color);
    position: relative;
}

.has-search-results .section-header::after {
    content: "Contains matches";
    position: absolute;
    right: 3rem;
    font-size: 0.8rem;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-weight: 500;
}

.no-results-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-style: italic;
    background-color: var(--white);
    border-radius: var(--radius-md);
    margin: 1rem 0;
    box-shadow: var(--shadow-sm);
}

.file-item.search-selected {
    background-color: rgba(37, 99, 235, 0.08);
    border: 1px solid var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.15);
    position: relative;
}

.file-item.search-selected::before {
    content: "";
    position: absolute;
    left: -2px;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: var(--primary-color);
}

.search-loading {
    text-align: center;
    padding: 12px 15px;
    background-color: var(--white);
    border-radius: var(--radius-md);
    margin: 10px 0;
    font-style: italic;
    color: var(--text-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.search-loading i {
    color: var(--primary-color);
    font-size: 1rem;
    animation: spin 1s linear infinite;
}

/* --- Level Tags --- */
.file-item[data-level="Beginner"] {
    border-left: 4px solid var(--success);
}

.file-item[data-level="Intermediate"] {
    border-left: 4px solid var(--warning);
}

.file-item[data-level="Advanced"] {
    border-left: 4px solid var(--error);
}

.file-item[data-level="Beginner"]:hover {
    border-left: 4px solid var(--success);
    background-color: rgba(16, 185, 129, 0.1);
}

.file-item[data-level="Intermediate"]:hover {
    border-left: 4px solid var(--warning);
    background-color: rgba(245, 158, 11, 0.1);
}

.file-item[data-level="Advanced"]:hover {
    border-left: 4px solid var(--error);
    background-color: rgba(239, 68, 68, 0.1);
}

.file-item[data-level^="A1"],
.file-item[data-level^="A2"],
.file-item[data-level^="B1"],
.file-item[data-level^="B2"],
.file-item[data-level^="C1"],
.file-item[data-level^="C2"] {
    border-left: none;
}

.file-item[data-level^="A1"]:hover,
.file-item[data-level^="A2"]:hover,
.file-item[data-level^="B1"]:hover,
.file-item[data-level^="B2"]:hover,
.file-item[data-level^="C1"]:hover,
.file-item[data-level^="C2"]:hover {
    border-left: none;
    background-color: var(--background-alt);
}

/* --- PDF Viewer --- */
.pdf-container {
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    padding: 1rem;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#pdf-canvas {
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.pdf-loading {
    text-align: center;
    padding: 2rem;
    width: 100%;
}

.pdf-loading i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.pdf-loading p {
    margin: 0;
    color: var(--text-color);
    font-weight: 500;
}

/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    overflow: hidden;
}

.modal-content {
    position: relative;
    background: var(--white);
    margin: 2vh auto;
    padding: 1.5rem;
    width: 90%;
    max-width: 1200px;
    height: 96vh;
    border-radius: 12px;
    overflow: hidden;
}

.close-button {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    color: var(--text-color);
    background: var(--white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 2001;
}

#pdf-preview-container {
    width: 100%;
    height: calc(96vh - 60px);
    overflow: auto;
    background: var(--background-alt);
    border-radius: 8px;
}

.loading,
.error {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

.error {
    color: var(--error);
}

/* ==========================================================================
   6. HEADER & NAVIGATION
   ========================================================================== */
header {
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 2000;
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

nav {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    position: relative;
    background-color: var(--white);
    z-index: 2001;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    z-index: 1001;
}

.logo i {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
    list-style: none;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-medium);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    z-index: 1001;
    padding: 0.5rem;
}

/* Search Container (Header) */
.search-container {
    position: relative;
    max-width: 600px;
    width: 100%;
    margin: 0 1rem;
}

#search-input {
    width: 100%;
    padding: 0.625rem 1rem;
    padding-right: 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    transition: var(--transition);
    background-color: var(--background-alt);
}

#search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--white);
    box-shadow: 0 0 0 3px var(--primary-light);
}

#search-button {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0;
    cursor: pointer;
    transition: var(--transition);
}

#search-button:hover {
    color: var(--primary-color);
}

/* Search Preview Styles */
#search-preview {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-suggestions {
    padding: 0.5rem 0;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.suggestion-item:hover {
    background-color: var(--background-alt);
}

.suggestion-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.suggestion-text {
    flex-grow: 1;
    margin-right: 1rem;
}

.suggestion-highlight {
    color: var(--primary-color);
    font-weight: 600;
}

.suggestion-category {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    background-color: var(--border-color);
    color: var(--text-medium);
    white-space: nowrap;
}

.suggestion-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--secondary-color);
}

.show-all-item {
    border-top: 1px solid var(--border-color);
    color: var(--primary-color);
    font-weight: 500;
}

.show-all-item:hover {
    background-color: var(--background-color);
}

/* Category-specific colors */
.suggestion-category[data-category="grammar"] {
    background-color: var(--info-bg);
    color: var(--primary-dark);
}

.suggestion-category[data-category="vocabulary"] {
    background-color: var(--level-beginner-bg);
    color: var(--level-beginner-text);
}

.suggestion-category[data-category="speaking"] {
    background-color: var(--level-intermediate-bg);
    color: var(--level-intermediate-text);
}

.suggestion-category[data-category="writing"] {
    background-color: var(--level-advanced-bg);
    color: var(--level-advanced-text);
}

.suggestion-category[data-category="lesson-plans"] {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

.suggestion-category[data-category="worksheets"] {
    background-color: var(--warning-bg);
    color: var(--warning);
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */
footer {
    background-color: var(--white);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-xl) 0;
    margin-top: auto;
}

.footer-content {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
}

.footer-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-links {
    display: flex;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text-medium);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: var(--transition);
    padding: 0.5rem;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.copyright {
    color: var(--text-light);
    font-size: 0.875rem;
    margin: 0;
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-20 {
    margin-bottom: 20px;
}



/* ==========================================================================
   13. RESPONSIVE OVERRIDES
   ========================================================================== */

/* Tablet & Mobile (max-width: 1024px) */
@media (max-width: 1024px) {
    .nav-links {
        gap: var(--spacing-md);
    }

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

    /* Hide main search on mobile/tablet header */
    .search-container {
        display: none;
    }

    /* Mobile Navigation Drawer */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--white);
        flex-direction: column;
        align-items: flex-start;
        padding: calc(var(--header-height) + 2rem) 2rem 2rem;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease-in-out;
        z-index: 1000;
        overflow-y: auto;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid var(--border-light);
    }

    .nav-links a {
        display: block;
        padding: 1rem 0;
        font-size: 1.1rem;
    }

    .nav-links .btn {
        width: 100%;
        margin-top: 0.5rem;
        text-align: center;
    }

    /* Mobile Search inside Menu */
    .mobile-search {
        width: 100%;
        margin-bottom: 1.5rem;
        position: relative;
    }

    .mobile-search input {
        width: 100%;
        padding: 0.75rem 1rem;
        padding-right: 2.5rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        font-size: 1rem;
    }

    .mobile-search button {
        position: absolute;
        right: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: var(--text-medium);
        padding: 0.5rem;
    }

    .mobile-search-item {
        display: block !important;
        margin-bottom: 1rem;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {

    /* Header & Nav */
    header {
        padding: 0;
    }

    nav {
        padding: 0 var(--spacing-md);
    }

    .logo {
        font-size: 1.2rem;
    }

    /* Material Grid */
    .material-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
        padding: 1rem;
    }

    /* File Items */
    .file-item {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }

    .file-content {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .file-name {
        font-size: 1rem;
        width: 100%;
        word-break: break-word;
        display: block;
    }

    .file-description {
        width: 100%;
        font-size: 0.9rem;
        display: block;
    }

    .button-container {
        flex-direction: row;
        justify-content: flex-start;
        width: 100%;
        gap: 0.5rem;
    }

    .details-button,
    .download-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        width: auto;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 5vh auto;
    }

    #pdf-preview-container {
        height: calc(90vh - 100px);
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {

    /* Navigation */
    nav {
        padding: 0.5rem;
    }

    .nav-links {
        flex-wrap: wrap;
    }

    .nav-links a {
        font-size: 0.9rem;
        padding: 0.3rem 0.5rem;
    }

    /* File Items */
    .file-item {
        padding: 0.75rem;
    }

    .button-container {
        flex-direction: column;
    }

    .details-button,
    .download-button {
        width: 100%;
        text-align: center;
    }

    /* Modal */
    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        height: 100vh;
        max-height: 100vh;
    }

    #pdf-preview-container {
        height: calc(100vh - 60px);
    }

    .close-button {
        top: 0.5rem;
        right: 0.5rem;
    }

    .search-preview {
        max-height: 60vh;
    }
}

/* Very Small Mobile Devices */
@media (max-width: 390px) {
    .file-item {
        padding: 0.5rem;
    }

    .file-name {
        font-size: 0.9rem;
    }

    .file-description {
        font-size: 0.8rem;
    }

    .button-container {
        gap: 0.25rem;
    }

    .details-button,
    .download-button {
        padding: 0.4rem;
        font-size: 0.8rem;
        min-height: 40px;
    }
}

/* Fix for iOS input zoom */
@media screen and (-webkit-min-device-pixel-ratio: 0) {

    select,
    textarea,
    input {
        font-size: 16px !important;
    }
}

/* Improved touch targets for mobile */
@media (hover: none) and (pointer: coarse) {

    .nav-links a,
    .button-container button,
    .close-button,
    .file-name {
        padding: 0.75rem;
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}






/* ==========================================================================
   8. LANDING PAGE
   ========================================================================== */

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    text-align: center;
    padding: clamp(2rem, 5vw, 3.5rem) 1.5rem;
    margin-bottom: clamp(2rem, 4vw, 3rem);
    position: relative;
    z-index: 1;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.hero h1 {
    font-size: clamp(1.75rem, 4vw + 0.5rem, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
    line-height: 1.1;
    overflow-wrap: break-word;
    word-break: break-word;
    color: var(--white);
}

.hero-text {
    font-size: clamp(1rem, 2vw, 1.125rem);
    font-weight: 400;
    margin-bottom: 2rem;
    opacity: 0.95;
    overflow-wrap: break-word;
    word-break: break-word;
    color: var(--white);
}

/* Ensure nav buttons have correct color */
.nav-links .btn-primary {
    color: var(--white);
}

.nav-links .btn-secondary {
    color: var(--text-medium);
}

.nav-links .btn-secondary:hover {
    color: var(--text-color);
}

/* Teaching Materials Section */
.materials-overview {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding: 2rem;
    text-align: center;
    position: relative;
    z-index: 2;
    background-color: var(--background-color);
    border-radius: 12px;
}

.materials-overview h2 {
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-color);
    margin-bottom: 0.75rem;
}

.section-description {
    color: var(--text-light);
    font-size: 1.0625rem;
    margin-bottom: 2.5rem;
}

.material-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: clamp(1rem, 2vw, 2rem);
    margin-top: 2rem;
}

.material-box {
    background-color: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 1.75rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
}

.material-box:hover {
    border-color: var(--border-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.material-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.material-box h3 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    overflow-wrap: break-word;
    word-break: break-word;
}

.material-box p {
    color: var(--text-light);
    font-size: 0.9375rem;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* About Section */
.about {
    background: linear-gradient(to bottom, var(--background-color), var(--white));
    padding: clamp(3rem, 6vw, 6rem) 1.5rem;
    position: relative;
    overflow: hidden;
}

.about::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--primary-light), transparent);
}

.about-content {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
    background: var(--white);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    position: relative;
}

.about-content h2 {
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.about-content h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.about-content p {
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 800px;
    margin: 2rem auto;
    position: relative;
    padding: 0 1rem;
}

.author-section {
    margin: 3rem auto;
    padding: 2rem;
    background: linear-gradient(to right bottom, var(--white), var(--background-color));
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
    max-width: 600px;
}

.author-section h3 {
    color: var(--text-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.author-bio {
    color: var(--text-color);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.linkedin-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.linkedin-button i {
    font-size: 1.2rem;
}

.linkedin-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
    .author-section {
        margin: 2rem auto;
        padding: 1.5rem;
    }

    .author-section h3 {
        font-size: 1.3rem;
    }

    .author-bio {
        font-size: 1rem;
        line-height: 1.6;
    }

    .linkedin-button {
        padding: 0.6rem 1.25rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .author-section {
        margin: 1.5rem auto;
        padding: 1.25rem;
    }

    .author-section h3 {
        font-size: 1.2rem;
    }

    .author-bio {
        font-size: 0.95rem;
        margin-bottom: 1.25rem;
    }

    .linkedin-button {
        width: 100%;
        justify-content: center;
    }
}

.features {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 3rem 0 2rem;
}

.feature {
    background: var(--white);
    padding: 1.25rem 1.75rem;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    min-width: 200px;
    box-shadow: var(--shadow-sm);
}

.feature:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--border-color);
}

.feature i {
    font-size: 1.5rem;
    color: var(--primary-color);
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.feature span {
    font-weight: 500;
    color: var(--text-color);
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {


    .about {
        padding: 4rem 1.5rem;
    }

    .about-content {
        padding: 2rem 1.5rem;
    }

    .about h2 {
        font-size: 2rem;
    }

    .about p {
        font-size: 1rem;
        line-height: 1.6;
        margin: 1.5rem auto;
    }

    .features {
        gap: 1rem;
        margin: 2rem 0;
    }

    .feature {
        padding: 1.25rem 1.5rem;
        min-width: 180px;
    }
}

@media (max-width: 480px) {


    .about-content {
        padding: 1.5rem 1rem;
    }

    .about h2 {
        font-size: 1.75rem;
    }

    .about p {
        font-size: 0.95rem;
        padding: 0;
        margin: 1.25rem auto;
    }

    .feature {
        width: 100%;
        justify-content: center;
    }

    .feature span {
        font-size: 1rem;
    }
}



.cta-container {
    margin-top: 2rem;
    text-align: center;
}

/* Specific styles for the refresh button */
#refresh-button {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#refresh-button:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: transparent;
}

#refresh-button:hover i {
    animation: refresh-spin 0.6s ease;
}

#refresh-button:active {
    transform: scale(0.97);
}

@keyframes refresh-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

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

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

.hero-content,
.material-box,
.about-content {
    animation: fadeIn 0.8s ease-out forwards;
}

/* Materials page styles */
.materials-page {
    padding-top: 80px;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 2rem;
    padding-right: 2rem;
    position: relative;
    z-index: 1;
}

.page-header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--white);
}

.page-header .section-description {
    color: var(--white);
    opacity: 0.9;
    margin-bottom: 0;
}

.refresh-section {
    margin-top: 2rem;
}

/* Collapsible section styles with higher specificity */
body .material-section {
    background-color: var(--white);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

body .section-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--primary-color);
    color: var(--white);
    cursor: pointer;
    position: relative;
    z-index: 2;
    border-radius: 8px 8px 0 0;
}

body .section-header i {
    margin-right: 1rem;
    font-size: 1.5rem;
    color: var(--white);
}

body .section-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--white);
}

body .section-header .toggle-icon {
    position: absolute;
    right: 1.5rem;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    color: var(--white);
}

body .material-section.collapsed .toggle-icon {
    transform: rotate(-90deg) !important;
}

body .files-container {
    max-height: 500px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 100% !important;
    padding: 1rem !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.8rem !important;
    background-color: var(--background-color);
    border-radius: 0 0 8px 8px;
}

body .material-section.collapsed .files-container {
    max-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    margin: 0 !important;
    border: none !important;
    height: 0 !important;
    display: none !important;
}





/* Keep the improved styling for search elements */

/* Button container styles */
.button-container {
    display: flex;
    gap: 10px;
    min-width: 55px;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 1;
}





.material-section {
    margin-bottom: 2rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section-header {
    padding: 1.5rem;
    background: var(--primary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: var(--transition);
}

.section-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-header .toggle-icon {
    transition: transform 0.3s ease;
}

.material-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}





/* --- Add secondary button style --- */








/* ==========================================================================
   10. ADMIN PANEL
   ========================================================================== */

/* Admin Dashboard Styles */
.admin-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    background: var(--white);
    padding: 24px 32px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

.admin-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-title h1 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.75rem;
    font-weight: 700;
}

.admin-actions {
    display: flex;
    gap: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

/* [REFACTORED]
.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover::before {
    opacity: 1;
}
*/

.stat-icon {
    font-size: 2rem;
    margin-bottom: 16px;
    color: var(--primary-color);
    background: var(--primary-light);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-color);
    margin: 8px 0;
    line-height: 1.2;
}

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

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

/* [REFACTORED]
.admin-card {
    background: var(--white);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 100%;
}

.admin-card h2 {
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f3f4f6;
}

.admin-card h2 i {
    color: var(--primary-color);
}
*/

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* [REFACTORED]
.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    box-shadow: var(--shadow);
}

.quick-action-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.quick-action-btn i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 4px;
}
*/

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s;
}

.activity-item:hover {
    background-color: var(--background-color);
    padding-left: 8px;
    padding-right: 8px;
    border-radius: 8px;
    margin: 0 -8px;
}

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

.activity-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    color: var(--text-color);
    font-weight: 600;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-meta {
    color: var(--text-light);
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.4;
}

.top-materials-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.material-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.material-item:hover {
    background-color: #f9fafb;
    padding-left: 8px;
    padding-right: 8px;
    border-radius: 8px;
    margin: 0 -8px;
}

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

.material-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
    margin-right: 16px;
}

.material-title {
    color: var(--text-color);
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.material-category {
    color: var(--text-light);
    font-size: 0.875rem;
    display: inline-block;
    padding: 2px 8px;
    background: #f3f4f6;
    border-radius: 4px;
    width: fit-content;
}

.material-downloads {
    background: var(--primary-light);
    padding: 6px 12px;
    border-radius: 20px;
    color: var(--primary-color);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .admin-container {
        padding: 0 16px;
        margin-top: 20px;
    }

    .admin-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        padding: 20px;
    }

    .admin-title {
        flex-direction: column;
        gap: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .quick-actions {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   11. AUTH PAGES
   ========================================================================== */

/* Login Page Styles */
.login-container {
    max-width: 400px;
    margin: 100px auto 50px;
    padding: 30px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--text-color);
    margin-bottom: 10px;
}

.error-message {
    background-color: var(--error-bg);
    color: var(--error);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

.success-message {
    background-color: var(--success-bg);
    color: var(--success);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    color: var(--text-color);
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 5px rgba(37, 99, 235, 0.3);
}

.login-button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-button:hover {
    background-color: var(--secondary-color);
}

.forgot-password-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
}

.signup-link {
    color: var(--primary-color);
    text-decoration: none;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* ==========================================================================
   12. MATERIALS PAGE
   ========================================================================== */

/* Files Container */
.files-container {
    padding: 1.5rem;
    background-color: var(--white);
}

.files-container article {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.files-container article:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.files-container article h4 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.files-container article p {
    color: var(--text-light);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.files-container article p:last-child {
    margin-bottom: 0;
}

.files-container art.signup-link {
    color: var(--primary-color);
    text-decoration: none;
}

.login-link {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
}

.login-link a {
    color: var(--primary-color);
    text-decoration: none;
}

.login-link a:hover {
    text-decoration: underline;
}

.files-container article a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.files-container article a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}



/* Material Detail Page Styles */
.material-detail-page {
    background-color: var(--background-color);
    min-height: calc(100vh - 80px);
    /* Adjust based on header/footer height */
    padding: 2rem 1rem;
}

.material-container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.back-button {
    margin-bottom: 1rem;
}

/* [REFACTORED]
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary-color);
}
*/

.material-info {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
}

.material-info h1 {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.material-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-light);
}

.metadata-item i {
    color: var(--primary-color);
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.metadata-item p {
    margin: 0;
    font-size: 0.95rem;
}

.metadata-item span {
    color: var(--text-color);
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

/* Level Tags for Detail Page */
.level-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.level-tag-beginner {
    background-color: var(--level-beginner-bg);
    color: var(--level-beginner-text);
    border: 1px solid #bbf7d0;
}

.level-tag-intermediate {
    background-color: var(--level-intermediate-bg);
    color: var(--level-intermediate-text);
    border: 1px solid #bfdbfe;
}

.level-tag-advanced {
    background-color: var(--level-advanced-bg);
    color: var(--level-advanced-text);
    border: 1px solid #fecaca;
}

.pdf-container {
    background: var(--background-alt);
    padding: 1rem;
    border-radius: 8px;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-light);
    margin-top: 2rem;
}

.pdf-loading {
    text-align: center;
    color: var(--text-light);
}

.pdf-loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Materials Page Redesign */
.materials-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 20px;
    /* Restored padding but will handle top spacing via main */
    gap: 30px;
    min-height: calc(100vh - 80px);
}

.materials-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: white;
    padding: 20px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: calc(var(--header-height) + 20px);
    /* Adjusted top position */
    transform: none;
    /* Removed transform */
}

.sidebar-header h3 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 1.2rem;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.category-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.category-link:hover,
.category-link.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.category-link i {
    width: 20px;
    text-align: center;
}

.materials-content {
    flex-grow: 1;
    width: 0;
    /* Fix flex child overflow issues */
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.material-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.material-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--border-color);
}

.card-header {
    padding: 18px;
    background: var(--background-alt);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-icon {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.card-level {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.level-beginner {
    background: var(--level-beginner-bg);
    color: var(--level-beginner-text);
}

.level-intermediate {
    background: #dbeafe;
    color: var(--primary-dark);
}

.level-advanced {
    background: #fce7f3;
    color: #831843;
}

.card-body {
    padding: 20px;
    flex-grow: 1;
}

.card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 10px;
    color: var(--text-color);
    line-height: 1.4;
}

.card-author {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-description {
    font-size: 0.95rem;
    color: var(--secondary-color);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.card-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: 6px;
    text-align: center;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-details {
    background: var(--background-alt);
    color: var(--text-medium);
}

.btn-details:hover {
    background: var(--border-color);
    color: var(--text-color);
}

/* [REFACTORED]
.btn-download {
    background: var(--primary-color);
    color: white;
}

.btn-download:hover {
    background: var(--primary-dark);
}
*/


/* ==========================================================================
   13. PRICING PAGE
   ========================================================================== */

/* Pricing Page Styles */
.pricing-header {
    text-align: center;
    padding: 40px 20px;
    background: var(--background-alt);
    border-bottom: 1px solid var(--border-light);
}

.pricing-header h1 {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-color);
    margin-bottom: 0.75rem;
}

.pricing-header p {
    color: var(--text-light);
    font-size: 1.125rem;
}

.pricing-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.pricing-card {
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    transition: var(--transition);
}

.pricing-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.pricing-card.popular {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
    transform: scale(1.02);
    z-index: 1;
}

.pricing-card.popular:hover {
    transform: scale(1.02) translateY(-3px);
    box-shadow: var(--shadow-md);
}

.popular-badge {
    /* Position: Static (in-flow) to prevent overlap */
    position: relative;
    align-self: center;
    margin-top: -1rem;
    margin-bottom: 1rem;
    background: var(--primary-color);
    color: var(--white);
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

.plan-name {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    text-align: center;
}

.plan-price {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.plan-price span {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 400;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    flex-grow: 1;
}

.plan-features li {
    padding: 0.625rem 0;
    color: var(--text-medium);
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.plan-features li i {
    color: var(--success);
    width: 18px;
    flex-shrink: 0;
}

.plan-features li i.fa-times {
    color: var(--text-muted);
}

.btn.outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-medium);
    box-shadow: none;
}

.btn.outline:hover {
    background: var(--background-alt);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn.current {
    background: var(--background-color);
    color: var(--text-light);
    cursor: default;
    box-shadow: none;
    border: 1px solid transparent;
}

.btn.current:hover {
    transform: none;
    background: var(--background-color);
}

@media (max-width: 900px) {
    .pricing-container {
        grid-template-columns: 1fr;
        max-width: 500px;
    }

    .pricing-card.popular {
        transform: scale(1);
    }

    .pricing-card.popular:hover {
        transform: translateY(-3px);
    }
}

/* Login/Signup Container */
.login-container {
    max-width: 450px;
    width: 90%;
    margin: 4rem auto;
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.login-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9375rem;
    color: var(--text-medium);
}

.login-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.login-link a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .login-container {
        margin: 2rem auto;
        width: 95%;
    }
}



/* ==========================================================================
   14. USER PROFILE
   ========================================================================== */

/* User Profile Styles */
.profile-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.profile-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.profile-header h1 {
    color: var(--text-color);
    margin: 0;
    font-size: 1.75rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* [REFACTORED]
.info-card {
    background: var(--background-alt);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-light);
}
*/
.info-label {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.info-value {
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.plan-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.plan-free {
    background: #E5E7EB;
    color: #374151;
}

.plan-pro {
    background: #DBEAFE;
    color: #1E40AF;
}

.plan-pro_plus {
    background: #D1FAE5;
    color: #065F46;
}

.credits-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.credits-count {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
}



/* ==========================================================================
   15. UTILITIES
   ========================================================================== */

/* Utility Classes */
.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.text-primary {
    color: var(--primary-color);
}

.text-warning {
    color: var(--warning);
}

.text-muted {
    color: var(--text-light);
}

.w-full {
    width: 100%;
}

.text-sm {
    font-size: 0.9rem;
}

.text-xs {
    font-size: 0.8rem;
}

/* ==========================================================================
   16. RESPONSIVE OVERRIDES
   ========================================================================== */

/* Files Container */
@media (max-width: 768px) {
    .files-container {
        padding: 1rem;
    }

    .files-container article {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }

    .files-container article h4 {
        font-size: 1rem;
        line-height: 1.4;
        word-break: break-word;
    }

    .files-container article p {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .files-container article a {
        font-size: 0.9rem;
        padding: 0.5rem 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .files-container {
        padding: 0.75rem;
    }

    .files-container article {
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .files-container article h4 {
        font-size: 0.95rem;
    }

    .files-container article p {
        font-size: 0.85rem;
    }
}

/* Material Detail Page */
@media (max-width: 768px) {
    .material-container {
        padding: 1.5rem;
    }

    .material-info h1 {
        font-size: 2rem;
    }

    .material-metadata {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-button {
        width: 100%;
        justify-content: center;
    }

    .pdf-container {
        padding: 1rem;
    }
}

/* Materials Layout */
@media (max-width: 1024px) {
    .materials-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 1rem;
        padding: 0 1rem;
    }

    .materials-sidebar {
        position: sticky;
        top: var(--header-height);
        z-index: 90;
        padding: 0.75rem;
        margin: 0 -1rem;
        /* Negative margin to go full width */
        border-radius: 0;
        border-left: none;
        border-right: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Hide scrollbar */
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE/Edge */
    }

    .materials-sidebar::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .category-nav {
        flex-direction: row;
        width: max-content;
        padding: 0 1rem;
        /* Add padding to content so it's not cut off */
    }

    .category-link {
        white-space: nowrap;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        border: 1px solid var(--border-light);
    }

    .category-link.active {
        border-color: var(--primary-color);
    }

    .materials-hero {
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
    }

    .materials-hero h1 {
        font-size: 1.5rem;
    }
}

/* Admin & Profile */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }

    .profile-container {
        margin: 1rem;
        padding: 1.5rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* Accessibility & Semantic Overrides */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

h2.plan-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    margin-top: 0;
}

/* ==========================================================================
   16. PAGE: MATERIAL DETAIL & ANALYTICS
   ========================================================================== */

/* --- Material Detail Page --- */
.material-detail-page {
    padding-top: calc(var(--header-height) + 2rem);
    background-color: var(--bg-body);
    min-height: 100vh;
}

/* Reset the outer container when used on this page to prevent double-card effect */
.material-detail-page .material-container {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
    max-width: 1000px;
    margin: 0 auto;
}

.material-detail-container {
    max-width: 1000px;
    margin: 0 auto 2rem;
    padding: 2.5rem;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.material-back-btn {
    align-self: flex-start;
    margin-bottom: 0.5rem;
}

.material-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.material-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.material-header h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    color: var(--text-color);
    margin-bottom: 1rem;
    margin-top: 0;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.material-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    width: 100%;
}

.material-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-body);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    color: var(--text-medium);
    font-weight: 500;
    border: 1px solid var(--border-light);
    text-transform: capitalize;
}

.material-meta-item i {
    color: var(--primary-color);
    font-size: 1em;
}

.material-actions {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 0.5rem;
}

.material-preview-section {
    background: var(--bg-body);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background-color: #f8fafc;
}

/* Enhanced Download Button */
.btn-download {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-download:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

.btn-download i {
    font-size: 1.1rem;
}

/* Loading State Enhancement */
#pdf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    width: 100%;
}

#pdf-loading i {
    font-size: 2.5rem;
    color: var(--primary-color);
    opacity: 0.8;
}

#pdf-loading p {
    color: var(--text-medium);
    font-weight: 500;
    margin: 0;
}

/* PDF Canvas styling */
#pdf-canvas {
    max-width: 100%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background-color: white;
    /* Hidden initially via JS or CSS if needed, but flex column handles it */
    position: relative;
    z-index: 1;
}

/* --- Admin Analytics --- */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.chart-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.chart-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.75rem;
}