@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Original Healthcare Color Palette */
    --primary: #2563EB;
    /* Royal Blue */
    --primary-hover: #1D4ED8;
    --primary-light: #EFF6FF;
    --secondary: #0F172A;
    /* Deep Slate */
    --accent: #38BDF8;
    /* Light Blue Accent */

    /* Semantic Colors */
    --success: #10B981;
    --success-bg: #D1FAE5;
    --warning: #F59E0B;
    --danger: #EF4444;
    --danger-bg: #FEE2E2;

    /* Neutrals */
    --surface: #FFFFFF;
    --background: #F8FAFC;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --input-bg: #F8FAFC;

    /* Elevate Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);

    /* Typography */
    --font-sans: 'Plus Jakarta Sans', sans-serif;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

html {
    scroll-behavior: smooth;
    font-size: 15px;
}

@media (max-width: 1024px) {
    html {
        font-size: 14.5px;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13.5px;
    }
}

body {
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Utilities */
.text-primary {
    color: var(--primary);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.text-muted {
    color: var(--text-muted);
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

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

a:hover {
    color: var(--primary-hover);
}

/* ── Global icon sizing (strictly constrained) ───────────────── */
[data-lucide],
.lucide,
svg.lucide,
.btn i,
.btn svg,
.input-icon {
    width: 18px !important;
    height: 18px !important;
}

/* Base Layout for Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    width: 100%;
}

/* Left/Right Container Layout */
.auth-form-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    /* Reduced horizontal padding for mobile */
    position: relative;
    background: var(--surface);
    min-height: 100vh;
    /* Changed from height: 100vh to allow natural flow */
    justify-content: center;
    /* Bring back justify-center for vertical alignment */
}

/* Hide scrollbar for form container but allow scrolling */
.auth-form-container::-webkit-scrollbar {
    width: 6px;
}

.auth-form-container::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: var(--radius-full);
}

.auth-form-content {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    /* Reverting to 0 auto since justify-center is back */
    padding: 1rem 0;
    /* Tighter vertical padding */
}

.auth-hero-container {
    flex: 1.2;
    display: none;
    position: relative;
    background: var(--primary);
    overflow: hidden;
}

@media (min-width: 768px) {
    .auth-hero-container {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }
}

.hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    mix-blend-mode: multiply;
}

.hero-content {
    position: relative;
    z-index: 10;
    padding: 4rem;
    color: white;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.4) 50%, transparent 100%);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.hero-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    width: fit-content;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.hero-content p {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 80%;
}

/* Header */
.auth-header {
    margin-bottom: 2rem;
    /* Slightly tighter */
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.auth-header h2 {
    font-size: 1.5rem;
    /* Better scale for mobile */
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
    /* Tighter grouping */
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

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

.input-icon {
    color: var(--text-muted);
    width: 14px;
    height: 14px;
    pointer-events: none;
    transition: var(--transition);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: var(--input-bg);
    transition: var(--transition);
}

.form-input::placeholder {
    color: #94A3B8;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-input:focus+.input-icon,
.form-input:not(:placeholder-shown)+.input-icon {
    color: var(--primary);
}

/* Native Select Styling */
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Two-column layout for forms */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

@media (max-width: 640px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .auth-header h2 {
        font-size: 1.75rem;
    }

    .auth-form-container {
        padding: 1.5rem;
        /* Even tighter for very small screens */
    }

    .auth-header {
        margin-bottom: 1.5rem;
    }
}

/* Custom Checkbox */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0;
    font-size: 0.875rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-muted);
    user-select: none;
}

.custom-checkbox {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background-color: var(--surface);
    cursor: pointer;
    display: grid;
    place-content: center;
    transition: var(--transition);
}

.custom-checkbox::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em white;
    background-color: transparent;
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.custom-checkbox:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.custom-checkbox:checked::before {
    transform: scale(1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    gap: 0.5rem;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Lucide icons inside buttons – smaller, no slide animation */
.btn svg,
.btn i {
    width: 14px;
    height: 14px;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Loader & Animations */
.hidden {
    display: none !important;
}

.spin {
    animation: rotate 1s linear infinite;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.loader-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: rotate 0.8s linear infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -12px;
    margin-top: -12px;
}

/* Premium White Toast Notification (Balanced & Responsive) */
.toast-container {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.toast {
    padding: 0.75rem 1.25rem; 
    background: #ffffff;
    color: var(--text-main);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); 
    display: flex;
    align-items: center;
    gap: 0.85rem; 
    font-weight: 500; 
    font-size: 0.95rem;
    border: 1px solid var(--border);
    pointer-events: auto;
    width: fit-content;
    max-width: 100%;
    
    /* Animation: Expand horizontally + Slide from Top (More pronounced) */
    opacity: 0;
    transform: translateY(-50px) scaleX(0) scaleY(0.7); 
    transform-origin: center;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    will-change: transform, opacity;
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scaleX(1) scaleY(1);
}

.toast i, .toast svg {
    width: 24px !important; 
    height: 24px !important; 
    flex-shrink: 0;
    stroke-width: 2.5; 
}

.toast-success i, .toast-success svg { color: var(--success); }
.toast-error i, .toast-error svg { color: var(--danger); }
.toast-warning i, .toast-warning svg { color: var(--warning); }
.toast-info i, .toast-info svg { color: var(--primary); }

@media (max-width: 480px) {
    .toast-container {
        top: 1rem;
    }
    .toast {
        padding: 0.65rem 1rem;
        font-size: 0.875rem;
        width: 100%;
    }
}

/* ── Premium Pagination (Theme Match - Rounded Rectangles) ───────────────────────── */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Slightly tighter gap for boxes */
    padding: 1.5rem 1rem 1rem;
    flex-wrap: wrap;
    background: transparent;
}

.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-sans);
    color: var(--text-main);
    background: var(--surface); /* Theme background */
    border: 1px solid var(--border); /* Subtle border */
    border-radius: 8px; /* Slightly rounded, NOT circular */
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    user-select: none;
}

/* Inactive numbers hover */
.pg-btn:hover:not(:disabled):not(.active):not(.ellipsis) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* Active Page - solid theme primary */
.pg-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
}

/* Arrow buttons */
.pg-btn.arrow {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%; /* Strictly circular */
    color: var(--text-muted);
    background: transparent;
}

.pg-btn.arrow:hover:not(:disabled) {
    background: var(--surface);
}

.pg-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-muted);
}

/* Ellipsis */
.pg-btn.ellipsis {
    cursor: default;
    background: transparent !important;
    border: none !important;
    min-width: 20px;
    padding: 0 2px;
    display: flex;
    gap: 2px;
    align-items: center;
    justify-content: center;
}

.pg-btn.ellipsis span {
    width: 2px;
    height: 2px;
    background: var(--text-main);
    border-radius: 50%;
    flex-shrink: 0;
    display: block;
}

.pg-btn i {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

/* ── Pagination Content Animation ────────────────────────────── */
@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-transition {
    animation: pageFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Custom Confirm Modal - Visual Match (Global) */
#custom-confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    align-items: center;
    justify-content: center;
}

#custom-confirm-modal.active {
    display: flex;
}

#custom-confirm-modal .modal-content {
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    position: relative;
    text-align: center;
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
}

.confirm-icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #f27474;
    color: #f27474;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.confirm-icon-circle i, .confirm-icon-circle svg {
    width: 52px; /* Increased from 40px */
    height: 52px; /* Increased from 40px */
}

#custom-confirm-modal h3 {
    color: #595959;
    font-size: 1.875rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

#confirm-msg-text {
    color: #797979;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.confirm-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
}

.confirm-actions .btn {
    flex: 1; /* Both buttons will have equal width */
    padding: 12px 20px;
    border-radius: 4px; /* Matches modal-content radius */
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

#confirm-cancel-btn {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

#confirm-cancel-btn:hover {
    background: #cbd5e1 !important;
}

#confirm-ok-btn {
    background: #ff2a56 !important;
    color: #fff !important;
}

#confirm-ok-btn:hover {
    background: #e6204a !important;
    box-shadow: 0 4px 12px rgba(255, 42, 86, 0.2);
}

/* Icon colors based on type */
.modal-overlay.type-danger .confirm-icon-circle { border-color: #f27474; color: #f27474; }
.modal-overlay.type-warning .confirm-icon-circle { border-color: #f8bb86; color: #f8bb86; }
.modal-overlay.type-success .confirm-icon-circle { border-color: #a5dc86; color: #a5dc86; }
