/* Student Enrollment System - Main Stylesheet */

:root {
    --color-teal: #009189;
    --color-light-blue: #BAE4F0;
    --color-navy: #004F9B;
    --color-orange: #FF6500;
    --color-yellow: #FFD500;
    --color-success: #198754;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --color-info: #0dcaf0;
    
    /* Brand gradients */
    --gradient-primary: linear-gradient(135deg, var(--color-teal) 0%, var(--color-navy) 100%);
    --gradient-auth: linear-gradient(135deg, var(--color-light-blue) 0%, var(--color-teal) 100%);
    --gradient-light: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    
    /* Shadows */
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    
    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

/* ====================
   GLOBAL STYLES
==================== */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Auth container gradient */
.auth-container {
    min-height: 100vh;
    background: var(--gradient-auth);
}

/* Custom divider */
.divider {
    position: relative;
}
.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--bs-border-color);
}
.divider span {
    background: var(--bs-body-bg);
}

/* ====================
   BUTTON STYLES
==================== */

.btn-primary-custom {
    background: var(--color-orange);
    border: 2px solid var(--color-orange);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.btn-primary-custom:hover {
    background: #e55a00;
    border-color: #e55a00;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 101, 0, 0.3);
}

.btn-outline-custom {
    background: transparent;
    border: 2px solid var(--color-orange);
    color: var(--color-orange);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.btn-outline-custom:hover {
    background: var(--color-orange);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 101, 0, 0.3);
}

.btn-teal {
    background: var(--color-teal);
    border: 2px solid var(--color-teal);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.btn-teal:hover {
    background: #007b73;
    border-color: #007b73;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 145, 137, 0.3);
}

/* ====================
   FORM STYLES
==================== */

.form-control-custom {
    border: 2px solid #e9ecef;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.form-control-custom:focus {
    border-color: var(--color-teal);
    box-shadow: 0 0 0 0.2rem rgba(0, 145, 137, 0.25);
}

/* ====================
   CARD STYLES
==================== */

.card-modern {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card-modern:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.card-student {
    border-left: 4px solid var(--color-teal);
    background: white;
    margin-bottom: 1.5rem;
}

.card-student.has-outstanding {
    border-left-color: var(--color-warning);
}

.student-avatar {
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
}

/* ====================
   STATUS BADGES
==================== */

.status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-enrolled {
    background: rgba(25, 135, 84, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(25, 135, 84, 0.3);
}

.status-payment-needed {
    background: rgba(255, 193, 7, 0.15);
    color: #b8860b;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.status-pending {
    background: rgba(13, 202, 240, 0.15);
    color: var(--color-info);
    border: 1px solid rgba(13, 202, 240, 0.3);
}

.status-rejected {
    background: rgba(220, 53, 69, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* ====================
   GENDER BADGES
==================== */

.gender-badge {
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
}

.gender-boy {
    background: rgba(13, 202, 240, 0.15);
    color: var(--color-info);
    border: 1px solid rgba(13, 202, 240, 0.3);
}

.gender-girl {
    background: rgba(220, 53, 69, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

/* ====================
   FINANCIAL STYLES
==================== */

.financial-summary {
    background: var(--gradient-light);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.financial-card {
    text-align: center;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.financial-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.financial-amount {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.financial-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ====================
   TEXT UTILITIES
==================== */

.text-navy {
    color: var(--color-navy) !important;
}

.text-orange {
    color: var(--color-orange) !important;
}

.text-teal {
    color: var(--color-teal) !important;
}

.bg-yellow-accent {
    background: linear-gradient(45deg, var(--color-yellow), #fff5a0);
    color: var(--color-navy);
}

/* ====================
   PAYMENT FORM STYLES (BOOTSTRAP OVERRIDE)
==================== */

/* Higher specificity to override Bootstrap */
.payment-option {
    display: block !important;
    position: relative;
    border: 2px solid #e9ecef !important;
    border-radius: var(--radius-md) !important;
    background: white !important;
    cursor: pointer !important;
    transition: all 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    text-decoration: none !important;
}

.payment-option:hover {
    border-color: var(--color-teal) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) !important;
    background: rgba(0, 145, 137, 0.05) !important;
}

.payment-option input[type="radio"] {
    position: absolute !important;
    top: 15px !important;
    left: 15px !important;
    margin: 0 !important;
    z-index: 2 !important;
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
}

.payment-option-content {
    padding: 1rem 1rem 1rem 3rem !important;
    width: 100% !important;
    border-radius: var(--radius-md) !important;
    transition: all 0.3s ease;
    cursor: pointer !important;
    display: block !important;
}

/* Selected state - higher specificity */
.payment-option input[type="radio"]:checked + .payment-option-content {
    background: rgba(0, 145, 137, 0.15) !important;
    color: var(--color-navy) !important;
}

.payment-option:has(input[type="radio"]:checked),
.payment-option input[type="radio"]:checked ~ *,
.payment-option input[type="radio"]:checked + * {
    border-color: var(--color-teal) !important;
    background: rgba(0, 145, 137, 0.1) !important;
}

/* Focus styles for accessibility */
.payment-option input[type="radio"]:focus {
    outline: 2px solid var(--color-teal) !important;
    outline-offset: 2px !important;
}

.payment-option input[type="radio"]:focus + .payment-option-content {
    border-color: var(--color-teal) !important;
}

/* Force clickable on the entire label */
.payment-option * {
    pointer-events: none;
}

.payment-option {
    pointer-events: all !important;
}

.payment-option input[type="radio"] {
    pointer-events: all !important;
}

/* Mobile improvements */
@media (max-width: 768px) {
    .payment-option {
        margin-bottom: 0.75rem !important;
    }
    
    .payment-option-content {
        padding: 0.875rem 0.875rem 0.875rem 2.75rem !important;
    }
    
    .payment-option input[type="radio"] {
        top: 12px !important;
        left: 12px !important;
    }
}

/* ====================
   FORM INPUT GROUP FIXES
==================== */

/* Fix Bootstrap input-group width issue - more aggressive */
.input-group {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    width: 100% !important;
}

.input-group > .form-control,
.input-group > .form-floating, 
.input-group > .form-select {
    position: relative !important;
    flex: 1 1 auto !important;
    width: auto !important; /* Override the problematic 1% */
    min-width: 0 !important;
    margin-bottom: 0 !important;
}

.input-group > .input-group-text {
    display: flex !important;
    align-items: center !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: #212529 !important;
    text-align: center !important;
    white-space: nowrap !important;
    background-color: #e9ecef !important;
    border: 1px solid #ced4da !important;
    flex-shrink: 0 !important;
}

/* Custom amount input styling */
#custom_amount_input {
    margin-top: 0.5rem !important;
    max-width: 200px !important; /* Prevent it from being too wide */
}

#custom_amount_input .input-group-text {
    border-radius: var(--radius-md) 0 0 var(--radius-md) !important;
    border-right: 0 !important;
}

#custom_amount_input .form-control {
    border: 2px solid #e9ecef !important;
    border-left: 0 !important;
    border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
    padding: 0.5rem 0.75rem !important;
}

#custom_amount_input .form-control:focus {
    border-color: var(--color-teal) !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 145, 137, 0.25) !important;
}

#custom_amount_input .form-control:focus + .input-group-text,
#custom_amount_input .form-control:focus ~ .input-group-text {
    border-color: var(--color-teal) !important;
}

/* Ensure the input group displays as flexbox properly */
#custom_amount_input.input-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
}

/* Force correct flex behavior */
#custom_amount_input .form-control {
    flex: 1 1 auto !important;
    width: 1% !important; /* This is actually correct for input groups */
}

#custom_amount_input .input-group-text {
    flex: 0 0 auto !important;
    width: auto !important;
}

/* ====================
   PAYMENT OPTION OVERRIDE FALLBACK
==================== */

/* If the above doesn't work, this is a more aggressive approach */
div.row.mb-3 .col-md-6 label.payment-option {
    border: 2px solid #e9ecef !important;
    border-radius: 12px !important;
    padding: 0 !important;
    background: white !important;
    cursor: pointer !important;
    display: block !important;
    position: relative !important;
    transition: all 0.3s ease !important;
}

div.row.mb-3 .col-md-6 label.payment-option:hover {
    border-color: #009189 !important;
    background: rgba(0, 145, 137, 0.05) !important;
    transform: translateY(-1px) !important;
}

/* Force radio button positioning */
label.payment-option input[type="radio"] {
    position: absolute !important;
    top: 15px !important;
    left: 15px !important;
    margin: 0 !important;
    z-index: 10 !important;
}

/* ====================
   MOBILE OPTIMIZATIONS
==================== */

@media (max-width: 768px) {
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        margin-bottom: 0.25rem;
    }
    
    .card-modern {
        border-radius: var(--radius-md);
    }
    
    .financial-summary {
        padding: 1.5rem;
    }
    
    .student-avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .enrollment-row {
        padding: 0.75rem;
    }
    
    /* Stack content vertically on mobile */
    .mobile-stack {
        flex-direction: column !important;
    }
    
    .mobile-center {
        text-align: center !important;
        margin-top: 1rem;
    }
}

@media (max-width: 576px) {
    .financial-amount {
        font-size: 1.4rem;
    }
    
    .card-student {
        margin-bottom: 1rem;
    }
}

/* ====================
   LOADING STATES
==================== */

.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====================
   LOGIN PAGE SPECIFIC
==================== */

.login-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.login-form-side {
    background: white;
    position: relative;
}

.login-info-side {
    background: var(--gradient-primary);
    color: white;
    position: relative;
}

.login-info-side::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="40" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="80" r="1.5" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.3;
}

.stats-box {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-content-custom {
    border-radius: var(--radius-lg);
    border: none;
}

.modal-header-custom {
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* ====================
   MOBILE LOGIN SPACING FIX
==================== */

.auth-container {
    min-height: 100vh;
    background: var(--gradient-auth);
    padding: 2rem 0; /* Add default padding */
}

/* Mobile spacing improvements */
@media (max-width: 991.98px) {
    .auth-container {
        padding: 3rem 1rem; /* More padding on tablet and below */
    }
    
    .login-card {
        border-radius: 15px;
        margin: 1rem 0; /* Additional margin for the card itself */
    }
    
    .login-info-side {
        order: 2; /* Info side goes below on mobile */
        min-height: 300px; /* Ensure minimum height */
    }
    
    .login-form-side {
        order: 1; /* Form stays on top on mobile */
        padding: 2rem 1.5rem !important; /* Ensure good internal padding */
    }
}

@media (max-width: 768px) {
    .auth-container {
        padding: 2rem 1rem; /* Adjust for smaller phones */
        align-items: flex-start; /* Start from top instead of center */
        padding-top: 3rem; /* Ensure top spacing */
        padding-bottom: 3rem; /* Ensure bottom spacing */
    }
    
    /* For register page */
    .card {
        margin: 1.5rem 0; /* Extra margin for register card */
    }
    
    .card-body {
        padding: 2rem 1.5rem; /* Good internal padding */
    }
}

@media (max-width: 576px) {
    .auth-container {
        padding: 2rem 0.75rem; /* Tighter horizontal padding on very small screens */
        padding-top: 2rem; /* Still keep vertical padding */
        padding-bottom: 2rem;
    }
    
    .login-form-side {
        padding: 1.5rem 1rem !important; /* Tighter internal padding */
    }
    
    .card-body {
        padding: 1.5rem 1rem; /* Tighter for register */
    }
}



/* Prevent full-height issues on mobile browsers */
@media (max-width: 768px) {
    .auth-container {
        min-height: 100vh;
        min-height: -webkit-fill-available; /* iOS Safari fix */
    }
    
    /* Ensure the container never touches the edges */
    .auth-container .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Add safe area for phones with notches */
    @supports (padding: max(0px)) {
        .auth-container {
            padding-top: max(2rem, env(safe-area-inset-top));
            padding-bottom: max(2rem, env(safe-area-inset-bottom));
        }
    }
}

/* Very small phones (iPhone SE, etc.) */
@media (max-width: 400px) {
    .auth-container {
        padding: 1.5rem 0.5rem;
    }
    
    .card-body {
        padding: 1.25rem 0.875rem !important;
    }
    
    .login-form-side {
        padding: 1.25rem 0.875rem !important;
    }
}

/* Landscape mode on phones */
@media (max-height: 500px) and (orientation: landscape) {
    .auth-container {
        align-items: flex-start;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .login-info-side {
        min-height: auto;
    }
}

/* ====================
   DASHBOARD SPECIFIC
==================== */

.welcome-header {
    background: var(--gradient-light);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.quick-actions {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.help-section {
    background: var(--gradient-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
}

/* ====================
   UTILITIES
==================== */

.border-3 {
    border-width: 3px !important;
}

.rounded-xl {
    border-radius: var(--radius-lg) !important;
}

.rounded-lg {
    border-radius: var(--radius-md) !important;
}

.rounded-md {
    border-radius: var(--radius-sm) !important;
}

.shadow-custom {
    box-shadow: var(--shadow-md) !important;
}

.transition-all {
    transition: all 0.3s ease !important;
}

/* Enhanced hover effects */
.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.hover-scale:hover {
    transform: scale(1.02);
}