/* School Result Management Frontend CSS */
@import url('https://fonts.googleapis.com/css2?family=Tiro+Bangla:ital,wght@0,400;0,600;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@300;400;500;600;700&display=swap');

/* Table Container Styles */
.table-container {
    max-width: 500px;
    margin: 20px auto;
    padding: 15px;
}

.table-title {
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    color: #2c3e50;
}

.table-content {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #ddd;
}

.table-content th,
.table-content td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: center;
}

.table-content th {
    background: #1A5F3F;
    font-weight: bold;
    color: #ffffff;
}

.srm-result-card {
    font-family: 'Noto Sans Bengali', 'Hind Siliguri', 'Tiro Bangla', Arial, sans-serif;
    max-width: 1000px;
    margin: 20px auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 2px solid #e1e8ed;
}

/* School Header Styling */
.school-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 30px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    border-bottom: none;
    overflow: hidden;
}

/* Updated: Hide school-logo for display page */
.srm-result-card .school-header .school-logo {
    display: none;
}

/* Updated: Center school-info when no logo is present */
.srm-result-card .school-header .school-info {
    margin: 0 auto;
}


.school-logo {
    margin-right: 20px;
    flex-shrink: 0;
}

.logo-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.logo-inner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 2px solid #ddd;
}

.logo-book {
    font-size: 24px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.school-info h1 {
    font-family: 'Noto Sans Bengali', 'Tiro Bangla', 'Hind Siliguri', Arial, sans-serif;
    font-size: 2.4em;
    margin: 0 0 15px 0;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    color: #ffffff;
}

.school-details {
    font-size: 1.2em;
    margin: 8px 0;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.school-address {
    font-size: 1.1em;
    margin: 8px 0;
    color: #ffffff;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.school-code {
    font-size: 1.1em;
    margin: 8px 0;
    color: #ffffff;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.school-contact {
    font-size: 1em;
    margin: 8px 0;
    color: #ffffff;
    border-top: 1px dashed rgba(255,255,255,0.3);
    padding-top: 8px;
    margin-top: 10px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Result Header */
.result-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 25px 20px;
    text-align: center;
    border-bottom: none;
    position: relative;
    overflow: hidden;
}

.result-header h2 {
    font-family: 'Noto Sans Bengali', 'Tiro Bangla', 'Hind Siliguri', Arial, sans-serif;
    font-size: 1.8em;
    margin: 0 0 10px 0;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    color: white !important;
}

.result-header h3 {
    font-size: 1.3em;
    margin: 0;
    font-weight: 500;
    color: #ecf0f1;
}


/* GPA Section */
.gpa-section {
    background: #ffffff;
    color: #2c3e50;
    border: 2px solid #e1e8ed;
    padding: 25px;
    text-align: center;
    margin: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.gpa-section h3 {
    font-family: 'Noto Sans Bengali', 'Tiro Bangla', 'Hind Siliguri', Arial, sans-serif;
    font-size: 1.6em;
    margin: 0 0 15px 0;
    font-weight: 600;
    color: #2c3e50;
}

.gpa-section p {
    font-size: 1.4em;
    margin: 0;
    font-weight: 600;
    color: #2c3e50;
}

/* Download Section */
.download-section {
    text-align: center;
    margin: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.download-btn {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Hind Siliguri', Arial, sans-serif;
}

.download-btn:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.download-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

/* Student Info Section */
.student-info {
    margin: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.student-info table {
    background: #ffffff;
    border: 2px solid #e1e8ed;
    width: 80%;
    margin: 0 auto;
    font-size: 14px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.student-info th {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: #ffffff;
    border: 1px solid #27ae60;
    padding: 12px 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.student-info td {
    background: #ffffff;
    color: #2c3e50;
    border: 1px solid #ecf0f1;
    padding: 10px 8px;
    font-size: 13px;
    text-align: center;
}

/* Results Table */
/* FIXED: Simple Results Table Design - Centered */
.results-table {
    background: #f8f9fa;
    padding: 20px;
    margin: 20px;
    border-radius: 10px;
    overflow-x: auto;
    display: flex;
    justify-content: center;
}

.results-table table {
    width: 80%;
    max-width: 800px;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.results-table th {
    background: #2c3e50;
    color: white;
    padding: 15px 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border: none;
    font-family: 'Hind Siliguri', Arial, sans-serif;
}

.results-table td {
    padding: 12px 10px;
    text-align: center;
    border: none;
    border-bottom: 1px solid #ecf0f1;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
}

.results-table tr:hover td {
    background: #f8f9fa;
}

.results-table tr:last-child td {
    border-bottom: none;
}

/* Subject name styling */
.results-table td:first-child {
    text-align: left;
    font-weight: 600;
    color: #34495e;
    padding-left: 20px;
}

/* Marks styling */
.results-table td:nth-child(2) {
    font-weight: 700;
    font-size: 16px;
    color: #2c3e50;
}

/* FIXED: Grade styling - Simple and clean */
.results-table td:nth-child(3) {
    font-weight: 700;
    font-size: 16px;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 0 4px;
    display: inline-block;
    min-width: 60px;
    text-align: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

/* Grade Colors */
.results-table td:nth-child(3).grade-A { 
    color: #27ae60; 
    background: #d4edda !important;
    border-color: #c3e6cb !important;
}
.results-table td:nth-child(3).grade-B { 
    color: #3498db; 
    background: #d1ecf1 !important;
    border-color: #bee5eb !important;
}
.results-table td:nth-child(3).grade-C { 
    color: #f39c12; 
    background: #fff3cd !important;
    border-color: #ffeaa7 !important;
}
.results-table td:nth-child(3).grade-D { 
    color: #e67e22; 
    background: #ffe8d1 !important;
    border-color: #ffd8a8 !important;
}
.results-table td:nth-child(3).grade-F { 
    color: #e74c3c; 
    background: #f8d7da !important;
    border-color: #f5c6cb !important;
}

/* Action styling */
.results-table td:last-child {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 500;
}

/* FIXED: Simple GPA Section Design - 2 Rows Only */
.gpa-section {
    background: #ffffff;
    color: #2c3e50;
    border: 2px solid #e1e8ed;
    padding: 25px;
    text-align: center;
    margin: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.gpa-section h3 {
    font-family: 'Noto Sans Bengali', 'Tiro Bangla', 'Hind Siliguri', Arial, sans-serif;
    font-size: 1.6em;
    margin: 0 0 20px 0;
    font-weight: 600;
    color: #2c3e50;
}

.gpa-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.gpa-section th {
    background: #e74c3c;
    color: white;
    padding: 15px 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border: none;
}

.gpa-section td {
    padding: 12px 10px;
    text-align: center;
    border: none;
    border-bottom: 1px solid #ecf0f1;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    background: white;
}

.gpa-section tr:last-child td {
    border-bottom: none;
}

/* GPA Section - 2 Rows with Special Note */
.gpa-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.gpa-section th {
    background: #e74c3c;
    color: white;
    padding: 15px 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    border: none;
}

.gpa-section td {
    padding: 12px 10px;
    text-align: center;
    border: none;
    border-bottom: 1px solid #ecf0f1;
    font-size: 14px;
    font-weight: 500;
    color: #2c3e50;
    background: white;
}

.gpa-section tr:last-child td {
    border-bottom: none;
}

/* Special note styling */
.gpa-section td[colspan="2"]:last-child {
    text-align: left;
    padding-left: 20px;
    font-size: 13px;
    color: #7f8c8d;
}

/* Mobile responsive table adjustments */
@media (max-width: 768px) {
    .results-table th:nth-child(1) {
        width: 35%;
    }
    
    .results-table th:nth-child(2) {
        width: 25%;
    }
    
    .results-table th:nth-child(3) {
        width: 20%;
    }
    
    .results-table th:nth-child(4) {
        width: 20%;
    }
}

@media (max-width: 480px) {
    .results-table th:nth-child(1) {
        width: 30%;
    }
    
    .results-table th:nth-child(2) {
        width: 25%;
    }
    
    .results-table th:nth-child(3) {
        width: 25%;
    }
    
    .results-table th:nth-child(4) {
        width: 20%;
    }
    
    .results-table {
        transform: scale(0.9);
        transform-origin: top left;
        width: 111.11%; /* Compensate for scale */
    }
}

.results-table tr:nth-child(even) td {
    background: #f8f9fa;
}

.results-table tr:hover td {
    background: #e8f4fd;
}

/* Responsive Design */
@media (max-width: 768px) {
    .srm-result-card {
        margin: 10px;
        border-radius: 10px;
    }
    
    .school-header {
        flex-direction: column;
        padding: 15px;
    }
    
    .school-logo {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .logo-circle {
        width: 60px;
        height: 60px;
    }
    
    .logo-inner {
        width: 45px;
        height: 45px;
    }
    
    .logo-book {
        font-size: 18px;
    }
    
    .school-info h1 {
        font-size: 1.6em;
    }
    
    .school-details {
        font-size: 1em;
    }
    
    .school-address, .school-code, .school-contact {
        font-size: 0.9em;
    }
    
    .result-header {
        padding: 15px;
    }
    
    .result-header h2 {
        font-size: 1.4em;
    }
    
    .result-header h3 {
        font-size: 1.1em;
    }
    
    .student-info {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .student-photo,
    .student-photo-placeholder {
        margin-right: 0;
        margin-bottom: 15px;
        width: 80px;
        height: 80px;
    }
    
    .student-details h3 {
        font-size: 1.4em;
    }
    
    .student-details p {
        font-size: 1em;
    }
    
    .table-container {
        max-width: 100%;
        margin: 15px auto;
        padding: 10px;
    }
    
    .results-table {
        padding: 15px;
        overflow-x: auto;
        max-width: 100%;
        margin: 10px;
        background: #ffffff;
        -webkit-overflow-scrolling: touch;
    }
    
    .results-table table {
        min-width: 100%;
        width: 100%;
        margin: 0 auto;
        background: #ffffff;
    }
    
    .results-table th,
    .results-table td {
        padding: 8px 4px;
        font-size: 0.8em;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .gpa-section {
        padding: 20px;
    }
    
    .gpa-section h3 {
        font-size: 1.3em;
    }
    
    .gpa-section p {
        font-size: 1.2em;
    }
    
    .download-section {
        padding: 20px;
    }
    
    .download-btn {
        padding: 12px 25px;
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .school-info h1 {
        font-size: 1.3em;
    }
    
    .school-details {
        font-size: 0.9em;
    }
    
    .school-address, .school-code, .school-contact {
        font-size: 0.8em;
    }
    
    .result-header h2 {
        font-size: 1.2em;
    }
    
    .result-header h3 {
        font-size: 1em;
    }
    
    .student-details h3 {
        font-size: 1.2em;
    }
    
    .table-container {
        max-width: 100%;
        margin: 10px auto;
        padding: 5px;
    }
    
    .results-table {
        max-width: 100%;
        margin: 5px;
        background: #ffffff;
        -webkit-overflow-scrolling: touch;
    }
    
    .results-table table {
        min-width: 100%;
        width: 100%;
        margin: 0 auto;
        background: #ffffff;
    }
    
    .results-table th,
    .results-table td {
        padding: 6px 3px;
        font-size: 0.75em;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .gpa-section h3 {
        font-size: 1.1em;
    }
    
    .gpa-section p {
        font-size: 1.1em;
    }
    
    .download-btn {
        padding: 10px 20px;
        font-size: 1em;
    }
}

/* Print Styles */
@media print {
    .srm-result-card {
        box-shadow: none;
        border: 1px solid #000;
        margin: 0;
        max-width: none;
        width: 100%;
        page-break-inside: avoid;
    }
    
    .download-section {
        display: none;
    }
    
    .school-header,
    .result-header,
    .gpa-section {
        background: #ffffff !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .school-info h1,
    .result-header h2,
    .result-header h3,
    .gpa-section h3,
    .gpa-section p {
        color: #000 !important;
        text-shadow: none !important;
    }
    
    .logo-circle,
    .logo-inner {
        background: #e0e0e0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .student-photo,
    .student-photo-placeholder {
        border-color: #000 !important;
    }

    /* Specific print styles for school-header to show logo */
    .school-header .school-logo {
        display: block !important; /* Show logo in print */
    }
    .school-header .school-info {
        margin: 0 !important; /* Remove auto margin in print */
    }
    .school-header .school-logo img {
        width: 70px; /* Match PDF size */
        height: 70px; /* Match PDF size */
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #000;
        margin-right: 15px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

.srm-admin .loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    margin-top: 10px;
    margin-bottom: 10px;
    margin-left: auto;
    margin-right: auto;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}



.lookup-form h3, .form-group label, .search-btn {
    color: white !important;
}

/* Accordion styles for results page */
.srm-student-results-accordion .student-result-item {
    border: 1px solid #ddd;
    margin-bottom: 10px;
    border-radius: 4px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.srm-student-results-accordion .student-result-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.srm-student-results-accordion .student-result-toggle {
    background: #f9f9f9;
    padding: 12px 18px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    position: relative;
    font-weight: 500;
    color: #333;
    transition: background-color 0.2s ease;
}

.srm-student-results-accordion .student-result-toggle:hover {
    background: #f1f1f1;
}

.srm-student-results-accordion .student-result-toggle.active {
    background: #e9e9e9;
    border-bottom-color: #ccc;
}

.srm-student-results-accordion .student-result-toggle::after {
    content: '';
    position: absolute;
    right: 18px;
    top: 50%;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    transform: translateY(-50%);
    transition: transform 0.2s ease;
}

.srm-student-results-accordion .student-result-toggle.active::after {
    transform: translateY(-50%) rotate(180deg);
}

.srm-student-results-accordion .student-result-content {
    padding: 18px;
    background: #fff;
    border-top: 1px solid #eee;
}

.srm-student-results-accordion .student-result-content .wp-list-table {
    margin: 0;
}
