/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.logo-section p {
    font-size: 1rem;
    opacity: 0.9;
}

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

.status-badge {
    display: inline-block;
    padding: 16px 32px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    animation: pulse 2s infinite;
}

.status-badge.qualified {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    border: 3px solid #27ae60;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.status-badge.not-qualified {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: 3px solid #e74c3c;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 35px rgba(39, 174, 96, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
    }
}

/* Cards */
.student-info,
.rank-summary,
.subject-marks,
.statistics,
.actions {
    padding: 40px;
}

.info-card,
.rank-card,
.marks-card,
.stats-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f1f1;
}

.info-card h2,
.rank-card h2,
.marks-card h2,
.stats-card h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: #2c3e50;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

/* Student Info */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.info-item label {
    font-weight: 500;
    color: #666;
}

.info-item span {
    font-weight: 600;
    color: #2c3e50;
}

/* Rank Display */
.rank-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.rank-item {
    text-align: center;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.rank-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.rank-item.primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
}

.rank-item h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 10px;
    opacity: 0.8;
}

.rank-item.primary h3 {
    color: rgba(255, 255, 255, 0.9);
}

.rank-number {
    font-size: 2.5rem;
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
}

.max-marks {
    font-size: 1rem;
    opacity: 0.7;
}

/* Subject Marks */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.paper-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.paper-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #495057;
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.subject-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #dee2e6;
}

.subject-row:last-child {
    border-bottom: none;
}

.subject-name {
    font-weight: 500;
    color: #495057;
}

.marks {
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    min-width: 80px;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    border-radius: 4px;
    transition: width 1s ease-in-out;
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-3px);
}

.stat-item h4 {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    opacity: 0.9;
}

.stat-item span {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Actions */
.actions {
    text-align: center;
    background: #f8f9fa;
}

.btn-primary {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(40, 167, 69, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.3);
    margin-left: 15px;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(108, 117, 125, 0.4);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
    opacity: 0.8;
}

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

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

/* Fade-in animation */
.fade-in {
    animation: fadeIn 0.8s ease-in;
}

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

/* Entry Screen Styles */
.entry-section {
    padding: 60px 40px;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.entry-card {
    background: white;
    border-radius: 16px;
    padding: 50px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f1f1;
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.entry-card h2 {
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
}

.entry-description {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 40px;
    line-height: 1.6;
}

.input-group {
    margin-bottom: 30px;
    text-align: left;
}

.input-group label {
    display: block;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1rem;
}

.input-group input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    letter-spacing: 2px;
}

.input-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-2px);
}

.input-group input:valid {
    border-color: #27ae60;
}

.input-error {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 8px;
    min-height: 20px;
}

.btn-primary {
    position: relative;
    overflow: hidden;
    min-width: 180px;
}

.btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

.btn-primary.loading .btn-spinner {
    display: inline-block;
}

.entry-info {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #3498db;
}

.entry-info p {
    margin: 0;
    font-size: 0.95rem;
    color: #666;
}

/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-screen.active {
    display: flex;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: 40px;
}

.loading-logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.loading-logo p {
    font-size: 1.2rem;
    margin-bottom: 40px;
    opacity: 0.9;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

.loading-text {
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.loading-progress {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.progress-bar-loading {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill-loading {
    height: 100%;
    background: white;
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.progress-text {
    font-size: 1rem;
    font-weight: 600;
    opacity: 0.9;
}

/* Hide entry container when loading */
.container.hidden {
    display: none;
}

/* Additional animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.entry-card {
    animation: fadeInUp 0.8s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px 0;
    }
    
    .header {
        padding: 20px;
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .logo-section h1 {
        font-size: 2rem;
    }
    
    .student-info,
    .rank-summary,
    .subject-marks,
    .statistics,
    .actions {
        padding: 20px;
    }
    
    .info-card,
    .rank-card,
    .marks-card,
    .stats-card {
        padding: 20px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .rank-display {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .subjects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .subject-row {
        grid-template-columns: 1fr;
        gap: 10px;
        text-align: center;
    }
    
    .progress-bar {
        order: 3;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rank-number {
        font-size: 2rem;
    }
    
    .stat-item span {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .paper-section {
        padding: 15px;
    }
    
    .btn-primary {
        padding: 12px 30px;
        font-size: 1rem;
    }
    
    .btn-secondary {
        padding: 12px 30px;
        font-size: 1rem;
        margin-left: 0;
        margin-top: 15px;
        display: block;
        width: 100%;
    }
    
    .actions {
        text-align: center;
    }
    
    /* Entry screen responsive styles */
    .entry-section {
        padding: 30px 20px;
        min-height: 50vh;
    }
    
    .entry-card {
        padding: 30px 25px;
    }
    
    .entry-card h2 {
        font-size: 1.8rem;
    }
    
    .entry-description {
        font-size: 1rem;
    }
    
    .input-group input {
        padding: 14px 16px;
        font-size: 1rem;
    }
    
    .loading-content {
        padding: 20px;
    }
    
    .loading-logo h1 {
        font-size: 2rem;
    }
    
    .loading-logo p {
        font-size: 1rem;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
    }
    
    .loading-text {
        font-size: 1rem;
    }
}
