/* Results Page Styles - Override all other styles */

/* Force visibility with highest specificity */
body main#main-content .results-page,
body .container .results-page {
    margin: 20px 0 !important;
    padding: 20px !important;
    background: #ffffff !important;
    color: #333333 !important;
    font-family: Arial, sans-serif !important;
}

body main#main-content .results-page *,
body .container .results-page * {
    color: #333333 !important;
}

/* Page Header */
body main#main-content .page-header,
body .container .page-header {
    text-align: center !important;
    margin-bottom: 30px !important;
    padding: 20px !important;
    background: #C00404 !important;
    color: #ffffff !important;
    border-radius: 8px !important;
}

body main#main-content .page-title,
body .container .page-title {
    font-size: 2.5em !important;
    margin: 0 0 10px 0 !important;
    font-weight: bold !important;
    color: #ffffff !important;
}

body main#main-content .page-subtitle,
body .container .page-subtitle {
    font-size: 1.2em !important;
    margin: 0 !important;
    color: #ffffff !important;
}

/* Search Section */
body main#main-content .search-section,
body .container .search-section {
    background: #f8f9fa !important;
    padding: 25px !important;
    border-radius: 8px !important;
    margin-bottom: 30px !important;
    border: 1px solid #dee2e6 !important;
}

body main#main-content .search-form h3,
body .container .search-form h3 {
    color: #C00404 !important;
    margin-bottom: 20px !important;
    text-align: center !important;
    font-weight: bold !important;
}

body main#main-content .form-group,
body .container .form-group {
    margin-bottom: 20px !important;
}

body main#main-content .form-group label,
body .container .form-group label {
    display: block !important;
    margin-bottom: 5px !important;
    font-weight: bold !important;
    color: #333333 !important;
}

body main#main-content .form-group input,
body .container .form-group input {
    width: 100% !important;
    padding: 12px !important;
    border: 2px solid #ddd !important;
    border-radius: 5px !important;
    font-size: 16px !important;
    background: #ffffff !important;
    color: #333333 !important;
    box-sizing: border-box !important;
}

body main#main-content .form-group input:focus,
body .container .form-group input:focus {
    border-color: #C00404 !important;
    outline: none !important;
}

body main#main-content .form-actions,
body .container .form-actions {
    text-align: center !important;
    margin-top: 25px !important;
}

body main#main-content .btn,
body .container .btn {
    padding: 12px 30px !important;
    border: none !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: bold !important;
    margin: 0 10px !important;
    text-decoration: none !important;
    display: inline-block !important;
}

body main#main-content .btn-primary,
body .container .btn-primary {
    background: #C00404 !important;
    color: #ffffff !important;
}

body main#main-content .btn-primary:hover,
body .container .btn-primary:hover {
    background: #8B0000 !important;
    color: #ffffff !important;
}

body main#main-content .btn-secondary,
body .container .btn-secondary {
    background: #6c757d !important;
    color: #ffffff !important;
}

body main#main-content .btn-secondary:hover,
body .container .btn-secondary:hover {
    background: #5a6268 !important;
    color: #ffffff !important;
}

/* Results Section */
body main#main-content .result-section,
body .container .result-section {
    background: #ffffff !important;
    border-radius: 8px !important;
    border: 2px solid #dee2e6 !important;
    margin: 20px 0 !important;
}

body main#main-content .result-card,
body .container .result-card {
    background: #ffffff !important;
    color: #333333 !important;
}

body main#main-content .result-header,
body .container .result-header {
    color: #ffffff;
    padding: 20px;
    text-align: center;
}

body main#main-content .result-header h2,
body .container .result-header h2 {
    color: #ffffff !important;
    font-size: 1.8em !important;
    font-weight: bold !important;
    margin: 0 0 10px 0 !important;
}

body main#main-content .university-subtitle,
body .container .university-subtitle {
    color: #ffffff !important;
    font-size: 1.2em !important;
    margin: 0 !important;
}

/* Student Info */
body main#main-content .student-info,
body .container .student-info {
    padding: 25px !important;
    background: #f8f9fa !important;
    color: #333333 !important;
}

body main#main-content .student-details,
body .container .student-details {
    color: #333333 !important;
}

body main#main-content .detail-row,
body .container .detail-row {
    display: flex !important;
    margin-bottom: 10px !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid #eee !important;
}

body main#main-content .detail-row .label,
body .container .detail-row .label {
    font-weight: bold !important;
    color: #495057 !important;
    width: 200px !important;
}

body main#main-content .detail-row .value,
body .container .detail-row .value {
    color: #212529 !important;
    flex: 1 !important;
}

body main#main-content .result-header,
body .container .result-header {
    color: #ffffff;
    padding: 20px;
    text-align: center;
}

.result-header h2 {
    color: #ffffff;
    font-size: 1.8em;
    font-weight: bold;
    margin: 0 0 10px 0;
}

.university-subtitle {
    color: #ffffff;
    font-size: 1.2em;
    margin: 0;
}

/* Student Info */
.student-info {
    padding: 25px;
    background: #f8f9fa;
    color: #333333;
}

.student-details {
    color: #333333;
}

.detail-row {
    display: flex;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.detail-row .label {
    font-weight: bold;
    color: #495057;
    width: 200px;
}

.detail-row .value {
    color: #212529;
    flex: 1;
}

/* Year Results */
.year-result {
    margin: 20px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #ffffff;
}

.year-header {
    background: #17a2b8;
    color: #ffffff;
    padding: 15px 20px;
    font-weight: bold;
    font-size: 1.2em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.year-header h3 {
    color: #ffffff;
    margin: 0;
}

.result-status {
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 15px;
    color: #ffffff;
}

/* Tables */
.subjects-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #ffffff;
}

.subjects-table th {
    background: #343a40;
    color: #ffffff;
    padding: 12px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #dee2e6;
}

.subjects-table td {
    padding: 12px;
    border: 1px solid #dee2e6;
    text-align: center;
    color: #333333;
    background: #ffffff;
}

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

.group-header td {
    background: #e9ecef;
    font-weight: bold;
    color: #495057;
    text-align: left;
}

.group-total td {
    background: #d4edda;
    font-weight: bold;
    color: #155724;
}

/* Year Total */
.year-total {
    background: #cce5ff;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    color: #004085;
    border-top: 3px solid #007bff;
}

/* Final Results */
.final-result {
    background: #d1ecf1;
    padding: 20px;
    margin: 20px;
    border-radius: 8px;
    border: 2px solid #17a2b8;
}

.final-total, .final-status, .division {
    display: inline-block;
    margin: 10px 20px 10px 0;
    padding: 10px 15px;
    background: #ffffff;
    border-radius: 5px;
    border-left: 4px solid #C00404;
    font-size: 1.1em;
    color: #495057;
}

.final-status {
    border-left-color: #28a745;
}

.division {
    border-left-color: #17a2b8;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 40px;
    background: #fff3cd;
    border: 2px solid #ffeaa7;
    border-radius: 8px;
    color: #856404;
    margin: 20px 0;
}

.alert-warning h4 {
    color: #856404;
    margin-bottom: 15px;
}

.alert-warning p {
    color: #856404;
}

/* Print Button */
.print-button {
    background: #28a745;
    color: #ffffff;
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin: 20px auto;
    display: block;
}

.print-button:hover {
    background: #218838;
}

/* Responsive */
@media (max-width: 768px) {
    .results-page {
        padding: 10px;
    }
    
    .detail-row {
        flex-direction: column;
    }
    
    .detail-row .label {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .year-header {
        flex-direction: column;
        text-align: center;
    }
    
    .subjects-table {
        font-size: 14px;
    }
}

.form-group input:focus {
    border-color: #C00404;
    outline: none;
    box-shadow: 0 0 5px rgba(192, 4, 4, 0.3);
}

.form-actions {
    text-align: center;
    margin-top: 25px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.3s;
    margin: 0 10px;
}

.btn-primary {
    background: #C00404 !important;
    color: white !important;
}

.btn-primary:hover {
    background: #8B0000 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: #6c757d !important;
    color: white !important;
}

.btn-secondary:hover {
    background: #5a6268 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Results Section */
.result-section {
    background: white !important;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 2px solid #e9ecef;
    color: #333 !important;
}

.result-header {
    background: linear-gradient(135deg, #C00404, #8B0000) !important;
    color: white !important;
    padding: 20px;
    text-align: center;
    position: relative;
}

.result-header h2 {
    color: white !important;
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.result-header .university-subtitle {
    color: white !important;
    font-size: 1.2em;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Student Info Section */
.student-info {
    padding: 25px;
    background: #f8f9fa !important;
    border-bottom: 3px solid #e9ecef;
    color: #333 !important;
}

.student-details {
    color: #333 !important;
}

.detail-row {
    display: flex;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.detail-row .label {
    font-weight: bold;
    color: #495057 !important;
    width: 200px;
    flex-shrink: 0;
}

.detail-row .value {
    color: #212529 !important;
    flex: 1;
}

.student-photo {
    flex-shrink: 0;
}

.student-photo img {
    width: 120px;
    height: 150px;
    border: 3px solid #C00404;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.student-info-text {
    flex: 1;
}

.info-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.info-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

.info-table td:first-child {
    font-weight: bold;
    color: #495057;
    width: 200px;
    background: #ffffff;
}

.info-table td:last-child {
    color: #212529;
    background: #f8f9fa;
}

/* Year Results */
.year-result {
    margin-bottom: 25px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: white !important;
}

.year-header {
    background: linear-gradient(135deg, #17a2b8, #138496) !important;
    color: white !important;
    padding: 15px 20px;
    font-weight: bold;
    font-size: 1.2em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.year-header h3 {
    color: white !important;
    margin: 0;
}

.result-status {
    background: rgba(255,255,255,0.2) !important;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    color: white !important;
}

/* Subject Tables */
.subjects-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: white !important;
}

.subjects-table th {
    background: #343a40 !important;
    color: white !important;
    padding: 12px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #dee2e6;
}

.subjects-table td {
    padding: 12px;
    border: 1px solid #dee2e6;
    text-align: center;
    color: #333 !important;
    background: white !important;
}

.subjects-table tbody tr:nth-child(even) {
    background: #f8f9fa !important;
}

.subjects-table tbody tr:nth-child(even) td {
    background: #f8f9fa !important;
}

.group-header td {
    background: #e9ecef !important;
    font-weight: bold;
    color: #495057 !important;
    text-align: left !important;
}

.group-total td {
    background: #d4edda !important;
    font-weight: bold;
    color: #155724 !important;
}

/* Year Total */
.year-total {
    background: #cce5ff !important;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    color: #004085 !important;
    border-top: 3px solid #007bff;
}

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

.subjects-table tbody tr:hover {
    background: #e3f2fd;
}

.paper-name {
    text-align: left !important;
    font-weight: 500;
}

.marks-obtained {
    font-weight: bold;
    color: #C00404;
}

.group-total {
    background: #d4edda !important;
    font-weight: bold;
    color: #155724;
}

/* Year Total */
.year-total {
    background: #cce5ff;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    color: #004085;
    border-top: 3px solid #007bff;
}

/* Final Results */
.final-results {
    background: #d1ecf1;
    padding: 25px;
    border-top: 3px solid #17a2b8;
}

.final-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.summary-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #17a2b8;
}

.summary-label {
    font-weight: bold;
    color: #495057;
    margin-bottom: 5px;
}

.summary-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #C00404;
}

/* Qualifying Subjects */
.qualifying-subjects {
    margin-top: 20px;
}

.qualifying-subjects h4 {
    color: #495057;
    margin-bottom: 15px;
    border-bottom: 2px solid #17a2b8;
    padding-bottom: 5px;
}

.qualifying-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.qualifying-table th,
.qualifying-table td {
    padding: 12px;
    border: 1px solid #dee2e6;
    text-align: center;
}

.qualifying-table th {
    background: #495057;
    color: white;
    font-weight: bold;
}

.qualifying-table .status-cleared {
    color: #28a745;
    font-weight: bold;
}

/* Final Results Summary */
.final-result {
    background: #d1ecf1 !important;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    border: 2px solid #17a2b8;
    color: #333 !important;
}

.final-total, .final-status, .division {
    display: inline-block;
    margin: 10px 20px 10px 0;
    padding: 10px 15px;
    background: white !important;
    border-radius: 5px;
    border-left: 4px solid #C00404;
    font-size: 1.1em;
    color: #495057 !important;
}

.final-status {
    border-left-color: #28a745 !important;
}

.division {
    border-left-color: #17a2b8 !important;
}

/* No Results Message */
.no-results {
    text-align: center;
    padding: 40px;
    background: #fff3cd !important;
    border: 2px solid #ffeaa7;
    border-radius: 8px;
    color: #856404 !important;
}

.alert-warning h4 {
    color: #856404 !important;
    margin-bottom: 15px;
}

.alert-warning p {
    color: #856404 !important;
}

/* Print Button */
.print-button {
    background: #28a745 !important;
    color: white !important;
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin: 20px 0;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.print-button:hover {
    background: #218838 !important;
}

/* Footer */
.footer {
    background: #343a40;
    color: white;
    padding: 20px 0;
    margin-top: 40px;
}

.footer-content {
    text-align: center;
}

.footer-content p {
    margin: 5px 0;
}

/* Alert Styles */
.alert {
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert h4 {
    margin-bottom: 10px;
    color: #856404;
}

.no-results {
    text-align: center;
    padding: 40px;
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #C00404;
    border-radius: 50%;
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .page-title {
        font-size: 2em;
    }
    
    .student-details {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .student-photo img {
        width: 100px;
        height: 125px;
    }
    
    .info-table td:first-child {
        width: 150px;
    }
    
    .year-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .year-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .final-summary {
        grid-template-columns: 1fr;
    }
    
    .subjects-table {
        font-size: 0.9em;
    }
    
    .subjects-table th,
    .subjects-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .search-section {
        padding: 15px;
    }
    
    .result-number {
        position: static;
        margin-top: 10px;
        display: block;
    }
    
    .subjects-table {
        font-size: 0.8em;
    }
}

/* Student Photo Styles */
.student-photo img {
    width: 120px;
    height: 150px;
    object-fit: cover;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
}

.student-photo img[src=""], 
.student-photo img:not([src]) {
    content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="150" viewBox="0 0 120 150"><rect width="120" height="150" fill="%23f8f9fa" stroke="%23dee2e6" stroke-width="2"/><text x="60" y="80" text-anchor="middle" font-family="Arial" font-size="12" fill="%236c757d">Photo Not Available</text></svg>');
}

/* Print Styles */
@media print {
    .search-section,
    .footer,
    .print-button {
        display: none !important;
    }
    
    .result-section {
        box-shadow: none;
        border: 2px solid #000;
        margin-top: 0;
    }
    
    .page-title {
        font-size: 2em;
        color: #000 !important;
    }
    
    .result-header,
    .year-header {
        background: #f0f0f0 !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .result-card {
        page-break-inside: avoid;
    }
}
