/* ==========================================================================
   CSJMU RESULTS PORTAL - STYLESHEET
   ========================================================================== */

/* Design Tokens & Variables */
:root {
    /* Color Palette */
    --primary: #1e3a8a;          /* Deep official blue */
    --primary-light: #3b82f6;    /* Modern accent blue */
    --primary-dark: #0f172a;     /* Deep slate */
    --accent-gold: #d4af37;      /* Premium certificate gold */
    --accent-gold-dark: #b8901c;
    --accent-crimson: #e11d48;   /* Red for primary CTA */
    --accent-crimson-hover: #be123c;
    --accent-teal: #0d9488;
    
    /* Backgrounds */
    --bg-dark: #070a13;
    --card-bg-light: rgba(255, 255, 255, 0.88);
    --card-bg-dark: rgba(15, 23, 42, 0.8);
    --card-border: rgba(255, 255, 255, 0.6);
    --card-border-glow: rgba(59, 130, 246, 0.2);

    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #f8fafc;

    /* Fonts */
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --font-serif: 'Playfair Display', serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Layout & Shadows */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.15);
    --shadow-crimson-glow: 0 0 20px rgba(225, 29, 72, 0.25);
    --shadow-teal-glow: 0 0 20px rgba(13, 148, 136, 0.3);

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: var(--font-main);
    color: var(--text-primary);
    background-color: var(--bg-dark);
    overflow-x: hidden;
}

/* Background Animations */
.mesh-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    background: radial-gradient(circle at 10% 20%, rgba(30, 58, 138, 0.4) 0%, transparent 40%),
                radial-gradient(circle at 90% 10%, rgba(79, 70, 229, 0.3) 0%, transparent 45%),
                radial-gradient(circle at 50% 80%, rgba(13, 148, 136, 0.25) 0%, transparent 50%),
                var(--bg-dark);
    filter: blur(40px);
    animation: mesh-movement 25s ease infinite alternate;
}

@keyframes mesh-movement {
    0% { background-position: 0% 0%, 0% 0%, 0% 0%; }
    50% { background-position: 10% 15%, -10% -20%, 5% 10%; }
    100% { background-position: -5% -10%, 15% 10%, -10% -5%; }
}

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center center;
}

.ambient-glow {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.35;
}

.glow-1 {
    top: -100px;
    left: -100px;
    background: var(--primary-light);
    animation: float-slow 15s ease-in-out infinite alternate;
}

.glow-2 {
    bottom: -150px;
    right: -100px;
    background: #8b5cf6;
    animation: float-slow 20s ease-in-out infinite alternate-reverse;
}

@keyframes float-slow {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, 30px) scale(1.1); }
    100% { transform: translate(-20px, -40px) scale(0.95); }
}

/* Layout Containers */
.app-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2.5rem 1.5rem;
    position: relative;
    z-index: 1;
}

/* Interactive Card Container */
.portal-card {
    width: 100%;
    max-width: 600px;
    background-color: var(--card-bg-light);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    transition: max-width var(--transition-slow), 
                padding var(--transition-slow), 
                transform var(--transition-normal);
}

/* Card expands slightly when result is shown */
.portal-card.expanded {
    max-width: 650px;
}

/* View State Management */
.card-view {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-normal) ease, 
                transform var(--transition-normal) ease;
}

.card-view.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.card-view.fade-out {
    opacity: 0;
    transform: translateY(-20px);
}

/* ==========================================================================
   STATE 1: FORM VIEW
   ========================================================================== */

/* Accreditation Badges with PNG support */
.accreditation-header {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1.5rem;
}

.logo-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-align: center;
    flex: 1;
}

.brand-img {
    height: 52px;
    max-width: 100%;
    object-fit: contain;
    transition: transform var(--transition-fast), filter var(--transition-fast);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.08));
}

.logo-box:hover .brand-img {
    transform: scale(1.08) translateY(-2px);
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.15));
}

.logo-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* University branding */
.university-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.university-crest {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.university-crest-img {
    height: 90px;
    width: 90px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    animation: crest-pulse 4s ease-in-out infinite;
}

@keyframes crest-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

.university-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.25px;
    line-height: 1.3;
}

.university-subtitle {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Divider styling */
.divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0 2rem;
    gap: 1rem;
}

.divider-line {
    flex-grow: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(30, 58, 138, 0.15) 30%, rgba(30, 58, 138, 0.15) 70%, transparent);
}

.divider-text {
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Form Styles */
#result-query-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.required-asterisk {
    color: var(--accent-crimson);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.input-icon svg {
    width: 18px;
    height: 18px;
}

.form-input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.6);
    border: 1.5px solid rgba(71, 85, 105, 0.2);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition-fast), 
                background-color var(--transition-fast), 
                box-shadow var(--transition-fast);
}

.form-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.7;
}

.form-input:focus {
    border-color: var(--primary-light);
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.form-input:focus + .focus-border + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--primary-light);
}

/* Error States */
.input-group.invalid .form-input {
    border-color: var(--accent-crimson);
    background-color: rgba(225, 29, 72, 0.03);
}

.input-group.invalid .form-input:focus {
    box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.12);
}

.input-group.invalid .input-icon {
    color: var(--accent-crimson);
}

.error-msg {
    display: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-crimson);
    margin-top: 2px;
    animation: shake 0.3s ease-in-out;
}

.input-group.invalid .error-msg {
    display: block;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Primary Action Button */
.submit-btn {
    width: 100%;
    padding: 16px;
    margin-top: 1rem;
    background: linear-gradient(135deg, var(--accent-crimson) 0%, var(--accent-crimson-hover) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm), var(--shadow-crimson-glow);
    transition: transform var(--transition-fast), 
                box-shadow var(--transition-fast), 
                filter var(--transition-fast);
    display: flex;
    justify-content: center;
    align-items: center;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 8px 25px rgba(225, 29, 72, 0.4);
    filter: brightness(1.05);
}

.submit-btn:active {
    transform: translateY(1px);
    box-shadow: var(--shadow-sm);
}

.btn-ripple {
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.8s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(30);
        opacity: 0;
    }
}

/* Footer layout inside form */
.form-footer {
    margin-top: 2rem;
    text-align: center;
}

.managed-by {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.copyright {
    font-size: 0.65rem;
    color: var(--text-muted);
}


/* ==========================================================================
   STATE 2: LOADING VIEW
   ========================================================================== */

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 0;
    text-align: center;
}

/* Cyber spinner */
.cyber-spinner {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}

.ring-outer {
    width: 100%;
    height: 100%;
    border-top-color: var(--primary-light);
    border-bottom-color: var(--primary-light);
    animation: spin-clockwise 2.2s linear infinite;
}

.ring-middle {
    width: 80%;
    height: 80%;
    border-left-color: var(--accent-gold);
    border-right-color: var(--accent-gold);
    animation: spin-counter-clockwise 1.6s linear infinite;
}

.ring-inner {
    width: 60%;
    height: 60%;
    border-top-color: var(--accent-crimson);
    animation: spin-clockwise 1s linear infinite;
}

.spinner-core {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
}

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

.loading-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
}

/* Progress bar */
.progress-bar-container {
    width: 80%;
    height: 6px;
    background-color: rgba(71, 85, 105, 0.1);
    border-radius: 10px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--accent-teal));
    border-radius: 10px;
    transition: width 0.15s cubic-bezier(0.1, 0.8, 0.25, 1);
}

/* Status steps */
.status-steps {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    width: 85%;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0.5;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.status-step.active {
    opacity: 1;
    color: var(--primary);
    font-weight: 700;
}

.status-step.completed {
    opacity: 0.9;
    color: var(--accent-teal);
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.status-step.active .step-dot {
    background-color: var(--primary-light);
    transform: scale(1.3);
    box-shadow: 0 0 8px var(--primary-light);
}

.status-step.completed .step-dot {
    background-color: var(--accent-teal);
    transform: scale(1);
}


/* ==========================================================================
   STATE 3: PDF DOWNLOAD VIEW
   ========================================================================== */

.download-portal {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0;
}

/* Simulated PDF Document Mockup Card */
.pdf-preview-container {
    margin-bottom: 1.75rem;
    perspective: 1000px;
}

.pdf-file-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--shadow-md), 0 4px 20px rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transform: rotateY(-5deg) rotateX(5deg);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.pdf-file-card:hover {
    transform: rotateY(0deg) rotateX(0deg) scale(1.03);
    box-shadow: var(--shadow-lg), 0 10px 30px rgba(0, 0, 0, 0.08);
}

.pdf-badge {
    background-color: #ef4444; /* PDF Red */
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    position: absolute;
    top: 12px;
    left: 12px;
    letter-spacing: 0.5px;
}

.pdf-icon-graphic {
    color: #ef4444;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    animation: bounce-slow 3s ease-in-out infinite;
}

.pdf-icon-graphic svg {
    width: 60px;
    height: 60px;
}

@keyframes bounce-slow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.pdf-filename {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-dark);
    word-break: break-all;
    max-height: 2.4em;
    overflow: hidden;
    line-height: 1.2;
    margin-bottom: 0.4rem;
}

.pdf-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.download-heading {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

/* Student Info Summary Table */
.student-summary-box {
    width: 100%;
    background-color: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    text-align: left;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    padding-bottom: 0.5rem;
}

.summary-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.summary-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.summary-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.highlight-name {
    color: var(--primary);
    letter-spacing: 0.25px;
}

/* Action button configurations */
.action-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
    margin-bottom: 1.5rem;
}

.download-link-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-teal) 0%, #0f766e 100%);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm), var(--shadow-teal-glow);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.download-link-btn svg {
    width: 20px;
    height: 20px;
}

.download-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 8px 25px rgba(13, 148, 136, 0.45);
}

.download-link-btn:active {
    transform: translateY(1px);
}

.secondary-btn {
    background-color: rgba(71, 85, 105, 0.08);
    color: var(--text-secondary);
    border: 1.5px solid rgba(71, 85, 105, 0.1);
    width: 100%;
    padding: 14px;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.secondary-btn:hover {
    background-color: rgba(71, 85, 105, 0.14);
    color: var(--text-primary);
}

/* Auto download status indicator */
.auto-download-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-teal);
    animation: fade-in-out 2s infinite alternate;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-teal);
    box-shadow: 0 0 8px var(--accent-teal);
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.5); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(13, 148, 136, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(13, 148, 136, 0); }
}

@keyframes fade-in-out {
    0% { opacity: 0.65; }
    100% { opacity: 1; }
}

/* Google Drive Configuration Note */
.google-drive-notice {
    background-color: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.7rem;
    color: var(--text-light);
    opacity: 0.85;
    line-height: 1.4;
    width: 100%;
}

.google-drive-notice code {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--accent-gold);
    display: inline-block;
    margin-top: 4px;
}

/* Status Badge inside summary box */
.status-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-pass {
    background-color: rgba(13, 148, 136, 0.1);
    color: var(--accent-teal);
    border: 1px solid rgba(13, 148, 136, 0.2);
}

.badge-fail {
    background-color: rgba(225, 29, 72, 0.1);
    color: var(--accent-crimson);
    border: 1px solid rgba(225, 29, 72, 0.2);
}

/* Placeholder warning styling */
.placeholder-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background-color: rgba(225, 29, 72, 0.08);
    border: 1px solid rgba(225, 29, 72, 0.25);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.75rem;
    color: var(--accent-crimson);
    text-align: left;
    width: 100%;
}

.placeholder-alert .alert-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.placeholder-alert code {
    background-color: rgba(225, 29, 72, 0.15);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--accent-crimson);
}

   RESPONSIVE DESIGN BREAKPOINTS
   ========================================================================== */

@media (max-width: 480px) {
    .portal-card {
        padding: 1.75rem;
    }

    .accreditation-header {
        gap: 1rem;
    }

    .brand-img {
        height: 44px;
    }

    .university-title {
        font-size: 1.05rem;
    }
    
    .divider-text {
        font-size: 0.8rem;
    }

    .pdf-file-card {
        width: 190px;
        padding: 1.25rem;
    }
}
