/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #28a745;
    --primary-dark: #1e7e34;
    --primary-light: #48d368;
    --primary-gradient: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    --bg-light: #f4f6f9;
    --bg-white: #ffffff;
    --text-dark: #333333;
    --text-muted: #6c757d;
    --text-light: #ffffff;
    --border-color: #dee2e6;
    --input-bg: #e8f0fe;
    --shadow: 0 14px 28px rgba(0,0,0,0.12), 0 10px 10px rgba(0,0,0,0.08);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 12px 32px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    letter-spacing: 1px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--text-light);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.5);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--text-light);
    border: 2px solid var(--text-light);
}

.btn-outline:hover {
    background: var(--text-light);
    color: var(--primary);
    text-decoration: none;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 8px 20px;
    font-size: 0.85rem;
}

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    font-size: 0.95rem;
    color: var(--text-dark);
    transition: border-color 0.3s ease, background 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* ===== PAGE LOADER ===== */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e9ecef;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ===== TOP PROGRESS BAR ===== */
.top-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--primary-gradient);
    z-index: 10000;
    transition: width 0.3s ease;
}

.top-progress.loading {
    animation: progressLoad 1.2s ease forwards;
}

.top-progress.done {
    width: 100%;
    transition: width 0.2s ease;
}

@keyframes progressLoad {
    0%   { width: 0; }
    30%  { width: 55%; }
    60%  { width: 78%; }
    100% { width: 92%; }
}

/* ===== FADE-IN ANIMATIONS ===== */
.fade-in {
    opacity: 0;
    transform: translateY(16px);
    animation: fadeInUp 0.4s ease forwards;
}

.fade-in:nth-child(1) { animation-delay: 0.05s; }
.fade-in:nth-child(2) { animation-delay: 0.1s; }
.fade-in:nth-child(3) { animation-delay: 0.15s; }
.fade-in:nth-child(4) { animation-delay: 0.2s; }
.fade-in:nth-child(5) { animation-delay: 0.25s; }

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

/* ===== SKELETON LOADING ===== */
.skeleton {
    background: linear-gradient(90deg, #e9ecef 25%, #f4f6f9 50%, #e9ecef 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 10px;
    width: 80%;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 60%; }

.skeleton-card {
    height: 90px;
    border-radius: var(--radius-sm);
}

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

/* ===== BUTTON LOADING STATE ===== */
.btn.loading {
    pointer-events: none;
    opacity: 0.75;
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ===== ALERT AUTO-DISMISS ===== */
.alert {
    animation: alertIn 0.3s ease;
}

.alert.dismissing {
    animation: alertOut 0.3s ease forwards;
}

@keyframes alertIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes alertOut {
    to {
        opacity: 0;
        transform: translateY(-8px);
        height: 0;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }
}

/* ===== MODAL ANIMATION ===== */
.modal-overlay {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-overlay.open {
    opacity: 1;
}

.modal {
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}

.modal-overlay.open .modal {
    transform: scale(1) translateY(0);
}

/* ===== UTILITY ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
