/* ==========================================
   AL MAHDI SCHOOLS - Premium Professional Design
   ========================================== */

:root {
    /* Primary Colors - React Design */
    --primary: #0a2342;
    --primary-light: #1565c0;
    --primary-dark: #051b2f;
    
    /* Secondary - Teal & Blue */
    --accent: #00bcd4;
    --accent-light: #4dd0e1;
    --accent-dark: #0097a7;
    
    /* Tertiary - Gold Accent */
    --teal: #00bcd4;
    --teal-light: #4dd0e1;
    
    /* Functional Colors */
    --success: #2e7d32;
    --success-light: #4caf50;
    --danger: #c62828;
    --danger-light: #e53935;
    --warning: #f57c00;
    --info: #1565c0;
    
    /* Neutrals */
    --light: #faf6f0;
    --light-gray: #fafafa;
    --gray: #90a4ae;
    --dark-gray: #37474f;
    --text-dark: #0a2342;
    --text-muted: #607d8b;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(10, 35, 66, 0.08);
    --shadow-md: 0 6px 16px rgba(10, 35, 66, 0.12);
    --shadow-lg: 0 12px 32px rgba(10, 35, 66, 0.15);
    --shadow-xl: 0 20px 48px rgba(10, 35, 66, 0.2);
}

/* ==========================================
   Base Styles
   ========================================== */

html {
    width: 100%;
    margin: 0;
    padding: 0;
    direction: rtl;
    box-sizing: border-box;
}

body {
    width: 100%;
    margin: 0;
    padding: 0;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    font-family: 'Segoe UI', 'Cairo', 'Tahoma', sans-serif;
    background-color: var(--light-gray);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
}

* {
    box-sizing: border-box;
}

/* ==========================================
   Typography
   ========================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    letter-spacing: -0.3px;
}

h1 {
    font-size: 2.75rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 2.25rem;
    margin-bottom: 1.25rem;
}

h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

h4 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

h5 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary-light);
}

p {
    color: var(--text-dark);
    margin-bottom: 1rem;
    line-height: 1.8;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

a:hover {
    color: var(--accent);
}

/* ==========================================
   Form Controls
   ========================================== */

input, select, textarea {
    direction: rtl;
    text-align: right;
    font-family: 'Cairo', 'Tahoma', sans-serif;
    border: 2px solid #e0e7ef;
    border-radius: 0.75rem;
    padding: 0.875rem 1.25rem;
    transition: all 0.3s ease;
    font-size: 1rem;
    background-color: #ffffff;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 52, 96, 0.1);
    outline: none;
    background-color: #fafbfc;
}

.form-control, .form-select {
    border: 2px solid #e0e7ef;
    border-radius: 0.75rem;
    padding: 0.875rem 1.25rem;
    transition: all 0.3s ease;
    background-color: #ffffff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 52, 96, 0.1);
    background-color: #fafbfc;
}

.form-control::placeholder {
    color: #b0bac1;
    font-weight: 500;
}

label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.625rem;
    display: block;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: 'Segoe UI', 'Cairo', sans-serif;
}

/* ==========================================
   Buttons
   ========================================== */

.btn {
    border: none;
    border-radius: 0.75rem;
    font-weight: 700;
    padding: 0.875rem 1.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: none;
    font-size: 1rem;
    cursor: pointer;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: var(--light);
    color: var(--text-dark);
    border: 2px solid var(--primary);
    font-weight: 600;
}

.btn-secondary:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-light) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-light) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline-primary {
    color: var(--primary);
    border: 2.5px solid var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    color: white;
}

.btn-sm {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1.125rem 2.5rem;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ==========================================
   Cards
   ========================================== */

.card {
    border: none;
    border-radius: 1.25rem;
    background-color: white;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 1.75rem;
    border-bottom: 4px solid var(--accent);
}

.card-body {
    padding: 2rem;
}

.card-title {
    color: var(--primary);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: -0.3px;
}

/* ==========================================
   Tables
   ========================================== */

.table {
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.table thead th {
    padding: 1.25rem;
    font-weight: 700;
    border: none;
    text-align: right;
    letter-spacing: 0.3px;
}

.table tbody td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e8ecf1;
    vertical-align: middle;
    color: var(--text-dark);
}

.table tbody tr:hover {
    background-color: var(--light-gray);
}

.table-sm td, .table-sm th {
    padding: 0.625rem;
}

/* ==========================================
   Alerts
   ========================================== */

.alert {
    border: none;
    border-left: 5px solid;
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.alert-success {
    background-color: #e8f5e9;
    border-color: var(--success);
    color: #1b5e20;
}

.alert-danger {
    background-color: #ffebee;
    border-color: var(--danger);
    color: #b71c1c;
}

.alert-warning {
    background-color: #fff3e0;
    border-color: var(--warning);
    color: #e65100;
}

.alert-info {
    background-color: #e1f5fe;
    border-color: var(--info);
    color: #01579b;
}

/* ==========================================
   Modal
   ========================================== */

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 1.75rem;
}

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.3px;
}

.modal-body {
    padding: 1.75rem;
}

.modal-footer {
    border-top: 1px solid #e8ecf1;
    padding: 1.5rem;
    background-color: #fafbfc;
}

/* ==========================================
   Validation
   ========================================== */

.valid.modified:not([type=checkbox]) {
    outline: 2px solid var(--success);
    outline-offset: 2px;
}

.invalid {
    outline: 2px solid var(--danger);
    outline-offset: 2px;
}

.validation-message {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.375rem;
    font-weight: 500;
}

/* ==========================================
   Utilities
   ========================================== */

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

.text-left {
    text-align: left !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-normal {
    font-weight: 400 !important;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.625rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.625rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }
.mt-5 { margin-top: 3rem !important; }

.p-1 { padding: 0.625rem !important; }
.p-2 { padding: 1rem !important; }
.p-3 { padding: 1.5rem !important; }
.p-4 { padding: 2rem !important; }
.p-5 { padding: 2.5rem !important; }

.px-3 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.py-3 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }
.d-none { display: none !important; }

.gap-2 { gap: 1rem !important; }
.gap-3 { gap: 1.5rem !important; }
.gap-4 { gap: 2rem !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.align-items-center { align-items: center !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }

.flex-column { flex-direction: column !important; }

.rounded { border-radius: 0.75rem !important; }
.rounded-lg { border-radius: 1.25rem !important; }

/* ==========================================
   Responsive Design
   ========================================== */

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.35rem; }
    h4 { font-size: 1.1rem; }
    
    .btn { 
        padding: 0.75rem 1.5rem; 
        font-size: 0.95rem; 
    }
    
    .card { 
        margin-bottom: 1.5rem;
        border-radius: 1rem;
    }
    
    .card-body { 
        padding: 1.5rem; 
    }
}

/* ==========================================
   Loading & Progress
   ========================================== */

/* Custom Branded Loader */
.custom-loader {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #fafafa 0%, #f5f8fa 100%) !important;
    z-index: 9999 !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

.loader-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 188, 212, 0.15);
    margin-bottom: 2rem;
    animation: logoFadeIn 0.6s ease-out;
    flex-shrink: 0;
}

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.loader-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0a2342;
    margin: 0 0 1.5rem 0;
    text-align: center;
    animation: fadeInUp 0.8s ease-out 0.2s both;
    direction: rtl;
    font-family: 'Cairo', 'Tahoma', sans-serif;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loader-line {
    width: 280px;
    max-width: 90%;
    height: 6px;
    background-color: #e8f0f5;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.loader-line-fill {
    height: 100%;
    background: linear-gradient(90deg, #00bcd4 0%, #1565c0 100%);
    border-radius: 10px;
    animation: loadingAnimation 1.5s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.5);
}

@keyframes loadingAnimation {
    0% {
        width: 0%;
        opacity: 0.8;
    }
    50% {
        width: 70%;
        opacity: 1;
    }
    100% {
        width: 100%;
        opacity: 0.8;
    }
}

.loader-text {
    margin-top: 1.5rem;
    font-size: 1rem;
    color: #607d8b;
    font-weight: 500;
    animation: fadeInUp 0.8s ease-out 0.6s both;
    direction: rtl;
    font-family: 'Cairo', 'Tahoma', sans-serif;
}

/* Responsive loader */
@media (max-width: 768px) {
    .custom-loader {
        padding: 15px !important;
    }

    .loader-logo {
        width: 100px;
        height: 100px;
        margin-bottom: 1.5rem;
    }

    .loader-title {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
        padding: 0 10px;
    }

    .loader-line {
        width: 240px;
        height: 5px;
    }

    .loader-text {
        font-size: 0.9rem;
        margin-top: 1.25rem;
    }
}

@media (max-width: 480px) {
    .loader-logo {
        width: 80px;
        height: 80px;
        margin-bottom: 1.25rem;
    }

    .loader-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    .loader-line {
        width: 180px;
        height: 4px;
    }

    .loader-text {
        font-size: 0.85rem;
        margin-top: 1rem;
    }
}

#blazor-error-ui {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-light) 100%);
    bottom: 0;
    box-shadow: var(--shadow-xl);
    display: none;
    left: 0;
    padding: 1.5rem 1.75rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.75rem;
    font-size: 1.5rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}

.blazor-error-boundary {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-light) 100%);
    padding: 1.5rem 1.5rem 1.5rem 3.5rem;
    color: white;
    border-radius: 0.75rem;
    margin: 1rem 0;
    box-shadow: var(--shadow-md);
}

/* ==========================================
   Custom Animations
   ========================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.4s ease-out;
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==========================================
   Scrollbar Styling
   ========================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--gray);
    border-radius: 5px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}


