/* =====================================================
   HHSCT Scholarship Management System
   Global Styles & Design System
   Theme: Dark Blue / White / Red
   ===================================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* =====================================================
   CSS Custom Properties (Design Tokens)
   ===================================================== */
:root {
    /* Primary Colors - Dark Blue */
    --primary-900: #050d18;
    --primary-800: #0a1628;
    --primary-700: #0d1b2a;
    --primary-600: #1b2838;
    --primary-500: #274060;
    --primary-400: #345580;
    --primary-300: #4a6fa5;
    --primary-200: #7b9cc7;
    --primary-100: #b0c8e8;
    --primary-50: #e0eaf5;

    /* Accent Colors - Red */
    --accent-700: #9b1b24;
    --accent-600: #c1121f;
    --accent-500: #e63946;
    --accent-400: #ef5461;
    --accent-300: #f7848e;
    --accent-200: #fbb4ba;
    --accent-100: #fde4e7;

    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f8f9fb;
    --gray-100: #f0f2f5;
    --gray-200: #e2e5ea;
    --gray-300: #ccd1d9;
    --gray-400: #a0a8b4;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Typography */
    --font-primary: 'Outfit', sans-serif;
    --font-secondary: 'Inter', sans-serif;

    /* Font Sizes - Fluid Typography */
    --text-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.75rem);
    --text-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);
    --text-base: clamp(0.9rem, 0.85rem + 0.25vw, 1rem);
    --text-lg: clamp(1rem, 0.95rem + 0.35vw, 1.125rem);
    --text-xl: clamp(1.15rem, 1rem + 0.5vw, 1.25rem);
    --text-2xl: clamp(1.3rem, 1.1rem + 0.8vw, 1.5rem);
    --text-3xl: clamp(1.6rem, 1.3rem + 1.2vw, 1.875rem);
    --text-4xl: clamp(1.9rem, 1.5rem + 1.6vw, 2.25rem);
    --text-5xl: clamp(2.2rem, 1.7rem + 2vw, 3rem);
    --text-6xl: clamp(2.5rem, 1.8rem + 3vw, 3.75rem);

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 50px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 30px rgba(230, 57, 70, 0.3);
    --shadow-card: 0 4px 20px rgba(13, 27, 42, 0.08);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
    --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-notification: 600;
    --z-tooltip: 700;
}

/* =====================================================
   CSS Reset
   ===================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-secondary);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary-700);
}

a {
    color: var(--accent-500);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-600);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: var(--font-secondary);
    border: none;
    outline: none;
}

input, select, textarea {
    font-family: var(--font-secondary);
    font-size: var(--text-base);
}

/* =====================================================
   Utility Classes
   ===================================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-sm { max-width: 800px; }
.container-lg { max-width: 1400px; }

.section {
    padding: var(--space-20) 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Grid */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 992px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 576px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    text-decoration: none;
    border: 2px solid transparent;
    min-height: 44px;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-600), var(--accent-700));
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(230, 57, 70, 0.4);
    color: var(--white);
}

.btn-secondary {
    background: transparent;
    color: var(--white);
    border-color: var(--white);
}

.btn-secondary:hover {
    background: var(--white);
    color: var(--primary-700);
    transform: translateY(-2px);
}

.btn-dark {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(13, 27, 42, 0.3);
}

.btn-dark:hover {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(13, 27, 42, 0.4);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    color: var(--accent-500);
    border-color: var(--accent-500);
}

.btn-outline:hover {
    background: var(--accent-500);
    color: var(--white);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: var(--white);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
    color: var(--white);
}

.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); min-height: 36px; }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-lg); min-height: 52px; }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* =====================================================
   Form Elements
   ===================================================== */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    color: var(--gray-800);
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    min-height: 46px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(39, 64, 96, 0.1);
}

.form-control.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-error {
    display: block;
    color: var(--danger);
    font-size: var(--text-xs);
    margin-top: var(--space-1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

@media (max-width: 576px) {
    .form-row { grid-template-columns: 1fr; }
}

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-6);
    transition: all var(--transition-normal);
    border: 1px solid var(--gray-100);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-100);
}

.card-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--primary-700);
}

/* Stat Cards */
.stat-card {
    position: relative;
    overflow: hidden;
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    color: var(--white);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
    opacity: 0.9;
}

.stat-card .stat-number {
    font-family: var(--font-primary);
    font-size: var(--text-4xl);
    font-weight: 800;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: var(--text-sm);
    opacity: 0.85;
    margin-top: var(--space-2);
}

.stat-card.bg-blue { background: linear-gradient(135deg, var(--primary-700), var(--primary-500)); }
.stat-card.bg-red { background: linear-gradient(135deg, var(--accent-500), var(--accent-600)); }
.stat-card.bg-green { background: linear-gradient(135deg, var(--success), #059669); }
.stat-card.bg-orange { background: linear-gradient(135deg, var(--warning), #d97706); }
.stat-card.bg-info { background: linear-gradient(135deg, var(--info), #2563eb); }

/* =====================================================
   Badges
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary { background: var(--primary-50); color: var(--primary-700); }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #1e40af; }

/* =====================================================
   Tables
   ===================================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}

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

.table thead th {
    background: var(--primary-700);
    color: var(--white);
    padding: var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.table thead th:first-child { border-radius: var(--radius-md) 0 0 0; }
.table thead th:last-child { border-radius: 0 var(--radius-md) 0 0; }

.table tbody td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--gray-100);
    font-size: var(--text-sm);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr:last-child td { border-bottom: none; }

/* =====================================================
   Custom In-Page Notifications
   ===================================================== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-notification);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 400px;
    width: 100%;
    pointer-events: none;
}

.notification {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-xl);
    border-left: 4px solid;
    animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: all;
    position: relative;
}

.notification.hiding {
    animation: slideOutRight 0.3s ease forwards;
}

.notification-success { border-color: var(--success); }
.notification-error { border-color: var(--danger); }
.notification-warning { border-color: var(--warning); }
.notification-info { border-color: var(--info); }

.notification-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-success .notification-icon { color: var(--success); }
.notification-error .notification-icon { color: var(--danger); }
.notification-warning .notification-icon { color: var(--warning); }
.notification-info .notification-icon { color: var(--info); }

.notification-content { flex: 1; }

.notification-title {
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--gray-800);
    margin-bottom: 2px;
}

.notification-message {
    font-size: var(--text-xs);
    color: var(--gray-500);
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.notification-close:hover {
    color: var(--gray-700);
}

.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0 var(--radius-md);
    animation: progressShrink 4s linear forwards;
}

.notification-success .notification-progress { background: var(--success); }
.notification-error .notification-progress { background: var(--danger); }
.notification-warning .notification-progress { background: var(--warning); }
.notification-info .notification-progress { background: var(--info); }

/* =====================================================
   Modal
   ===================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(13, 27, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-backdrop.active { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-100);
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--primary-700);
}

.modal-close {
    background: var(--gray-100);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--gray-500);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body { padding: var(--space-6); }

.modal-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--gray-100);
}

/* =====================================================
   Pagination
   ===================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-8);
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-600);
    background: var(--white);
    border: 1px solid var(--gray-200);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.page-btn:hover, .page-btn.active {
    background: var(--primary-700);
    color: var(--white);
    border-color: var(--primary-700);
}

/* =====================================================
   Animations
   ===================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes progressShrink {
    from { width: 100%; }
    to { width: 0%; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Animate on scroll utility */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--accent-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

/* =====================================================
   Scrollbar Styling
   ===================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* =====================================================
   Selection
   ===================================================== */
::selection {
    background: var(--accent-200);
    color: var(--primary-700);
}
