/* Common Subject Page Styles */

/* Subject Hero Sections */
.subject-hero {
    position: relative;
    padding: 80px 0;
    text-align: center;
    color: white;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
    overflow: hidden;
}

.subject-hero h1 {
    font-family: var(--heading-font);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.subject-hero p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 30px;
    position: relative;
    z-index: 2;
}

/* Floating Elements */
.floating-element,
.math-element,
.phys-element,
.chem-element,
.esc-element {
    position: absolute;
    color: rgba(255, 255, 255, 0.2);
    font-family: 'Times New Roman', serif;
    z-index: 2;
    animation: float 8s ease-in-out infinite;
}

.floating-element:nth-child(1),
.math-element:nth-child(1),
.phys-element:nth-child(1),
.chem-element:nth-child(1),
.esc-element:nth-child(1) {
    top: 20%;
    left: 10%;
    font-size: 40px;
    animation-delay: 0s;
}

.floating-element:nth-child(2),
.math-element:nth-child(2),
.phys-element:nth-child(2),
.chem-element:nth-child(2),
.esc-element:nth-child(2) {
    top: 30%;
    right: 15%;
    font-size: 60px;
    animation-delay: 1s;
}

.floating-element:nth-child(3),
.math-element:nth-child(3),
.phys-element:nth-child(3),
.chem-element:nth-child(3),
.esc-element:nth-child(3) {
    bottom: 25%;
    left: 20%;
    font-size: 50px;
    animation-delay: 2s;
}

.floating-element:nth-child(4),
.math-element:nth-child(4),
.phys-element:nth-child(4),
.chem-element:nth-child(4),
.esc-element:nth-child(4) {
    bottom: 15%;
    right: 10%;
    font-size: 45px;
    animation-delay: 3s;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Stream Containers */
.streams-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.stream-card {
    background: white;
    border-radius: var(--card-border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

.stream-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    opacity: 0;
    transition: var(--transition);
}

.stream-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.stream-card:hover::before {
    opacity: 1;
}

.stream-header {
    color: white;
    padding: 15px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stream-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
}

.stream-header h2 {
    font-family: var(--heading-font);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.stream-content {
    padding: 20px;
}

/* Subject Resource Buttons - Common styles */
.subject-buttons,
.math-buttons,
.phys-buttons,
.chem-buttons,
.esc-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.subject-btn,
.math-btn,
.phys-btn,
.chem-btn,
.esc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f3f8;
    color: var(--dark-color);
    padding: 15px;
    border-radius: var(--button-border-radius);
    text-decoration: none;
    font-weight: 500;
    border: 1px solid #e0e0e0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.subject-btn i,
.phys-btn i,
.chem-btn i,
.esc-btn i {
    margin-right: 10px;
    font-size: 1.1rem;
}

/* Custom Alert Styles */
.custom-alert {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.custom-alert.show {
    opacity: 1;
    visibility: visible;
}

.custom-alert-content {
    background-color: white;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.custom-alert.show .custom-alert-content {
    transform: scale(1);
}

.custom-alert-header {
    padding: 15px;
    background: var(--gradient);
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-alert-header i {
    font-size: 1.5rem;
}

.custom-alert-header span {
    font-size: 1.2rem;
    font-weight: 600;
}

.custom-alert-body {
    padding: 20px;
}

.custom-alert-body p {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
    line-height: 1.5;
}

.custom-alert-footer {
    padding: 15px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #eee;
}

.custom-alert-button {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-alert-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

/* PDF Modal Styles */
.pdf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pdf-modal.show {
    opacity: 1;
    visibility: visible;
}

.pdf-modal-content {
    background-color: white;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.pdf-modal.show .pdf-modal-content {
    transform: scale(1);
}

.pdf-modal-header {
    color: white;
    padding: 15px 20px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pdf-modal-header h3 {
    margin: 0 0 5px 0;
    font-size: 1.5rem;
    font-weight: 600;
    padding-right: 30px;
}

.pdf-modal-header p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.pdf-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
}

.pdf-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.pdf-modal-body {
    padding: 20px;
    max-height: calc(90vh - 70px);
    overflow-y: auto;
}

/* PDF Files Display */
.pdf-list h4 {
    font-size: 1.2rem;
    margin: 15px 0 10px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.pdf-files-container {
    margin-bottom: 20px;
}

.pdf-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.pdf-file-item:hover {
    background: #f0f0f0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.pdf-file-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.pdf-file-info i {
    font-size: 1.2rem;
    margin-right: 10px;
}

.pdf-file-name {
    font-size: 0.95rem;
    color: #333;
    word-break: break-word;
}

.pdf-file-actions {
    display: flex;
    gap: 10px;
}

.pdf-view-btn,
.pdf-download-btn {
    background: #f0f3f8;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.pdf-view-btn i,
.pdf-download-btn i {
    margin-right: 5px;
    font-size: 0.9rem;
}

/* Loading and No Files Messages */
.loading-text {
    padding: 15px;
    text-align: center;
    color: #666;
}

.loading-text i {
    margin-right: 8px;
}

.no-files-message {
    text-align: center;
    padding: 20px;
    color: #666;
}

.no-files-message i {
    font-size: 2rem;
    color: #ccc;
    margin-bottom: 10px;
    display: block;
}

.no-files-message p {
    margin: 5px 0;
}

/* PDF Viewer Modal Styles */
.pdf-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    display: none;
    transition: opacity 0.3s ease;
}

.pdf-viewer-modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.pdf-viewer-content {
    background-color: white;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    border-radius: 8px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.pdf-viewer-modal.show .pdf-viewer-content {
    transform: translateY(0);
}

.pdf-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    color: white;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.pdf-viewer-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.pdf-viewer-close {
    font-size: 1.8rem;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}

.pdf-viewer-close:hover {
    transform: scale(1.2);
}

.pdf-viewer-body {
    flex: 1;
    overflow: hidden;
    background-color: #f5f5f5;
    position: relative;
}

#pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* PDF loading indicator */
.pdf-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(245, 245, 245, 0.9);
    z-index: 5;
}

.pdf-loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.pdf-loading p {
    font-size: 1rem;
    color: #333;
    font-weight: 500;
}

/* Subject-specific styles */
/* Mathematics */
.mathematics-hero {
    background: linear-gradient(135deg, #ea481f 0%, #982c01 100%);
}

.mathematics-hero::after {
    content: '∫ ∑ ∞ π √ ∂ ∇ ∆ ∏ ∀ ∃ ∈ ∉ ∋ ∌ ∩ ∪ ⊂ ⊃ ⊆ ⊇';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 80px;
    font-family: 'Times New Roman', serif;
    opacity: 0.08;
    letter-spacing: 20px;
    z-index: 0;
    overflow: hidden;
    white-space: nowrap;
    transform: rotate(-5deg);
}

.mathematics-hero h1::after {
    content: '∫ f(x) dx';
    position: absolute;
    font-size: 1rem;
    top: -15px;
    right: -40px;
    opacity: 0.7;
    transform: rotate(15deg);
    font-family: 'Times New Roman', serif;
}

.math-btn:hover {
    background: #ff7e5f;
    color: white;
}

.stream-card.math-card::before,
.stream-header.math-header {
    background: linear-gradient(135deg, #ea481f 0%, #942b01 100%);
}

.pdf-modal-header.math-modal-header {
    background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
}

.pdf-file-info i.math-file-icon {
    color: #ff7e5f;
}

.pdf-view-btn.math-view-btn:hover {
    background: #ff7e5f;
    color: white;
    border-color: #ff7e5f;
}

.pdf-download-btn.math-download-btn:hover {
    background: #feb47b;
    color: white;
    border-color: #feb47b;
}

.pdf-loading-spinner.math-loading-spinner {
    border-top-color: #ff7e5f;
}

.pdf-viewer-header.math-viewer-header {
    background: linear-gradient(135deg, #f08469 0%, #ff6d33 100%);
}

/* Physics */
.physics-hero {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}

.physics-hero::after {
    content: 'E=mc² F=ma v=u+at s=ut+½at² F=G(m₁m₂)/r² E=hf PV=nRT';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 60px;
    font-family: 'Times New Roman', serif;
    opacity: 0.08;
    letter-spacing: 10px;
    z-index: 0;
    overflow: hidden;
    white-space: nowrap;
    transform: rotate(-5deg);
}

.phys-btn:hover {
    background: #3b82f6;
    color: white;
}

.stream-card.phys-card::before,
.stream-header.phys-header,
.pdf-modal-header.phys-modal-header,
.pdf-viewer-header.phys-viewer-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}

.pdf-file-info i.phys-file-icon {
    color: #3b82f6;
}

.pdf-view-btn.phys-view-btn:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.pdf-download-btn.phys-download-btn:hover {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}

.pdf-loading-spinner.phys-loading-spinner {
    border-top-color: #3b82f6;
}

/* Chemistry */
.chemistry-hero {
    background: linear-gradient(135deg, #29773E 0%, #093009 100%);
}

.chemistry-hero::after {
    content: 'H₂O CO₂ NaCl H₂SO₄ CH₄ C₆H₁₂O₆ NH₃ O₂ N₂ C₂H₅OH';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 60px;
    font-family: 'Times New Roman', serif;
    opacity: 0.08;
    letter-spacing: 10px;
    z-index: 0;
    overflow: hidden;
    white-space: nowrap;
    transform: rotate(-5deg);
}

.chem-btn:hover {
    background: #10b981;
    color: white;
}

.stream-card.chem-card::before,
.stream-header.chem-header,
.pdf-modal-header.chem-modal-header,
.pdf-viewer-header.chem-viewer-header {
    background: linear-gradient(135deg, #10b981 0%, #0D3E10 100%);
}

.pdf-file-info i.chem-file-icon {
    color: #10b981;
}

.pdf-view-btn.chem-view-btn:hover {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.pdf-download-btn.chem-download-btn:hover {
    background: #047857;
    color: white;
    border-color: #047857;
}

.pdf-loading-spinner.chem-loading-spinner {
    border-top-color: #10b981;
}

/* Engineering Science Courses (ESC) */

/* ESC Hero Section */
.esc-hero {
    background: linear-gradient(135deg, #6A5ACD 0%, #4B0082 100%);
}

.stream-header.esc-header,
.pdf-modal-header.esc-modal-header,
.pdf-viewer-header.esc-viewer-header {
    background: linear-gradient(135deg, #6A5ACD 0%, #4B0082 100%);
}

.esc-btn {
    border-radius: var(--button-border-radius);
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.esc-btn:hover {
    background: #6A5ACD;
    color: white;
    box-shadow: 0 5px 15px rgba(106, 90, 205, 0.3);
}

.stream-card.esc-card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow);
    border-radius: var(--card-border-radius);
    transition: var(--transition);
}

.stream-card.esc-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.pdf-file-info i.esc-file-icon {
    color: #6A5ACD;
}

.pdf-view-btn.esc-view-btn:hover {
    background: #6A5ACD;
    color: white;
    border-color: #6A5ACD;
}

.pdf-download-btn.esc-download-btn:hover {
    background: #4B0082;
    color: white;
    border-color: #4B0082;
}

.pdf-loading-spinner.esc-loading-spinner {
    border-top-color: #6A5ACD;
}

.esc-download-btn.download-success {
    background-color: #4CAF50 !important;
    border-color: #388E3C !important;
}

.esc-download-btn.download-error {
    background-color: #f44336 !important;
    border-color: #d32f2f !important;
}

/* Section header styling */
.section-header {
    text-align: center;
    margin: 3rem auto 2.5rem;
}

.section-subtitle {
    color: #666;
    font-size: 1.1rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Section title with icon */
.section-title {
    text-align: center;
    margin: 3rem auto 2rem;
    font-family: var(--heading-font);
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(135deg, #6A5ACD 0%, #4B0082 100%);
    border-radius: 3px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .subject-hero h1 {
        font-size: 2.5rem;
    }

    .subject-hero p {
        font-size: 1rem;
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .hero-text p {
        font-size: 1.1rem;
    }

    .streams-container {
        grid-template-columns: 1fr;
    }

    .pdf-modal-content {
        width: 95%;
    }

    .pdf-file-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .pdf-file-actions {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }

    .pdf-view-btn,
    .pdf-download-btn {
        flex: 1;
        justify-content: center;
    }

    .pdf-viewer-content {
        width: 95%;
        height: 85vh;
    }

    .pdf-viewer-header h3 {
        font-size: 1.1rem;
        max-width: 70%;
    }

    .mathematics-hero::after {
        font-size: 60px;
    }

    .custom-alert-content {
        max-width: 90%;
    }

    .custom-alert-header i {
        font-size: 1.3rem;
    }

    .custom-alert-header span {
        font-size: 1.1rem;
    }

    .custom-alert-body p {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .subject-hero h1 {
        font-size: 2rem;
    }

    .subject-hero {
        padding: 60px 0;
    }

    .subject-buttons,
    .math-buttons,
    .phys-buttons,
    .chem-buttons,
    .esc-buttons {
        gap: 10px;
    }

    .mathematics-hero::after {
        font-size: 40px;
        letter-spacing: 10px;
    }

    .custom-alert-content {
        width: 95%;
    }

    .custom-alert-header {
        padding: 12px;
    }

    .custom-alert-body {
        padding: 15px;
    }

    .custom-alert-footer {
        padding: 12px;
    }

    .pdf-viewer-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .pdf-viewer-header {
        padding: 0.8rem 1rem;
        border-radius: 0;
    }

    .pdf-viewer-header h3 {
        font-size: 1rem;
        max-width: 65%;
    }

    .pdf-viewer-close {
        font-size: 1.5rem;
    }
}

/* Download button states */
.pdf-download-btn.download-success {
    background-color: #4CAF50 !important;
    border-color: #388E3C !important;
    color: white !important;
    cursor: default;
}

.pdf-download-btn.download-error {
    background-color: #f44336 !important;
    border-color: #d32f2f !important;
    color: white !important;
    cursor: default;
}

/* Subject-specific success/error states */
.math-download-btn.download-success {
    background-color: #4CAF50 !important;
    border-color: #388E3C !important;
}

.phys-download-btn.download-success {
    background-color: #4CAF50 !important;
    border-color: #388E3C !important;
}

.chem-download-btn.download-success {
    background-color: #4CAF50 !important;
    border-color: #388E3C !important;
}

.math-download-btn.download-error,
.phys-download-btn.download-error,
.chem-download-btn.download-error {
    background-color: #f44336 !important;
    border-color: #d32f2f !important;
}

/* Disabled button styles */
.pdf-download-btn:disabled,
.pdf-view-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Spinner animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

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

.fa-spinner {
    animation: spin 1s linear infinite;
}