:root {
    /* --- Color Palette: Deep Emerald & Gold Luxury --- */
    --primary-color: #064e3b;
    /* Deep Emerald Green */
    --primary-light: #059669;
    /* Lighter Emerald for accents */
    --primary-dark: #022c22;
    /* Darkest Green */

    --accent-color: #d4af37;
    /* Metallic Gold */
    --accent-hover: #bfa131;
    /* Darker Gold */

    --bg-body: #f8fafc;
    /* Ultra light gray/white */
    --bg-card: #ffffff;
    /* Pure White */
    --bg-sidebar: #022c22;
    /* Matches Primary Dark */

    --text-main: #1f2937;
    /* Soft Black */
    --text-muted: #6b7280;
    /* Gray text */
    --text-light: #f3f4f6;
    /* Off-white text */

    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    /* --- Typography --- */
    --font-family: 'Kanit', sans-serif;

    /* --- Effects --- */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    color: var(--primary-dark);
    letter-spacing: -0.025em;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

h5 {
    font-size: 1.25rem;
}

h6 {
    font-size: 1rem;
}

p {
    margin-bottom: 1rem;
}

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

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

/* --- Animation & Transitions --- */
.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

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

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.slide-in-right {
    animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    transform: translateX(30px);
}

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

.scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    transform: scale(0.9);
}

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

.letter-spacing-1 {
    letter-spacing: 1px;
}

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

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

.spinner-primary {
    border-color: rgba(6, 78, 59, 0.2);
    border-top-color: var(--primary-color);
}

/* --- Sidebar Styling --- */
.app-sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    background: linear-gradient(180deg, var(--primary-dark) 0%, #0f4c3a 100%);
    color: white;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    transition: var(--transition-slow);
}

.app-sidebar::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.app-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.app-sidebar .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition-base);
}

.app-sidebar .sidebar-header:hover {
    transform: scale(1.02);
}

.app-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    padding: 12px 16px;
    transition: var(--transition-base);
    font-weight: 300;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.app-sidebar .nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-color);
    transform: scaleY(0);
    transition: var(--transition-fast);
}

.app-sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateX(6px);
    padding-left: 20px;
}

.app-sidebar .nav-link:hover::before {
    transform: scaleY(1);
}

.app-sidebar .nav-link i {
    transition: var(--transition-fast);
}

.app-sidebar .nav-link:hover i {
    transform: scale(1.1);
}

.nav-link.active {
    background: linear-gradient(90deg, var(--accent-color) 0%, #fcd34d 100%) !important;
    color: #000 !important;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
    transform: translateX(6px);
}

.nav-link.active::before {
    transform: scaleY(1);
    background: #000;
}

/* --- Card Styling --- */
.card,
.calendar-card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
    overflow: hidden;
}

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

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    border-bottom: none;
    font-weight: 500;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: var(--bg-body);
    border-top: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
}

/* --- Button Styling --- */
.btn {
    border-radius: var(--radius-md);
    padding: 0.625rem 1.5rem;
    font-weight: 400;
    transition: var(--transition-base);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    box-shadow: 0 4px 6px rgba(6, 78, 59, 0.2);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    box-shadow: 0 6px 14px rgba(6, 78, 59, 0.35);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #34d399 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    box-shadow: 0 6px 14px rgba(16, 185, 129, 0.35);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #f87171 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    box-shadow: 0 6px 14px rgba(239, 68, 68, 0.35);
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #fbbf24 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    box-shadow: 0 6px 14px rgba(245, 158, 11, 0.35);
    transform: translateY(-2px);
}

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

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

.btn-outline-secondary {
    border: 2px solid #e5e7eb;
    color: var(--text-muted);
    background: transparent;
}

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

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.125rem;
}

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

/* --- Form Controls --- */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-control,
.form-select {
    border-radius: var(--radius-md);
    border: 2px solid #e5e7eb;
    padding: 0.75rem 1rem;
    font-weight: 300;
    width: 100%;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: var(--transition-base);
    background: white;
}

.form-control:hover,
.form-select:hover {
    border-color: #d1d5db;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15);
    background: white;
}

.form-control::placeholder {
    color: #9ca3af;
}

.input-group {
    display: flex;
    width: 100%;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    transition: var(--transition-base);
}

.input-group .form-control {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: none;
}

.input-group:focus-within .input-group-text {
    border-color: var(--primary-light);
    background: rgba(5, 150, 105, 0.05);
}

.input-group:focus-within .form-control {
    border-color: var(--primary-light);
}

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

/* --- Table Styling --- */
.table-container {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

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

.table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

.table thead th {
    padding: 1rem 1.25rem;
    font-weight: 500;
    color: white;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    border: none;
    text-align: left;
}

.table tbody tr {
    transition: var(--transition-fast);
    border-bottom: 1px solid #f3f4f6;
}

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

.table-hover tbody tr:hover {
    background-color: #f0fdf4;
    transform: scale(1.005);
}

.table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    border: none;
}

.table tbody td:first-child {
    font-weight: 500;
}

/* --- Badge Styling --- */
.badge {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: white;
}

.badge-info {
    background: var(--info-color);
    color: white;
}

/* --- Alert Styling --- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: none;
    margin-bottom: 1rem;
    animation: slideInRight 0.5s ease-out;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

/* --- Calendar Specifics --- */
.calendar-card {
    padding: 2rem;
    border-top: none;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
}

.calendar-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--primary-color));
    animation: shimmer 3s infinite;
}

@keyframes shimmer {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.fc-toolbar {
    margin-bottom: 1.5rem !important;
}

.fc-toolbar-title {
    font-size: 1.75rem !important;
    font-weight: 600 !important;
    color: var(--primary-dark) !important;
    text-transform: capitalize;
}

.fc-button-primary {
    background: var(--primary-color) !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    font-weight: 400 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem !important;
    padding: 0.5rem 1rem !important;
    transition: var(--transition-base) !important;
}

.fc-button-primary:hover {
    background: var(--primary-light) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(6, 78, 59, 0.2) !important;
}

.fc-button-active {
    background: var(--accent-color) !important;
    color: #000 !important;
    font-weight: 500 !important;
}

.fc-col-header-cell {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    padding: 12px 0 !important;
    border-bottom: 2px solid var(--primary-light) !important;
    color: var(--primary-dark);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.fc-daygrid-day {
    transition: var(--transition-fast);
    position: relative;
}

.fc-daygrid-day:hover {
    background-color: #ecfdf5;
    cursor: pointer;
}

.fc-daygrid-day-number {
    padding: 8px;
    font-weight: 500;
}

.fc-day-today {
    background-color: rgba(5, 150, 105, 0.08) !important;
}

.fc-day-today .fc-daygrid-day-number {
    background: var(--accent-color);
    color: #000;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.fc-event {
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.85rem;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: var(--transition-fast);
    margin-bottom: 2px;
}

.fc-event:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

/* --- Modals --- */
.modal-content {
    border-radius: var(--radius-xl);
    border: none;
    box-shadow: var(--shadow-premium);
    animation: scaleIn 0.3s ease-out;
}

.modal-header {
    background: linear-gradient(135deg, var(--bg-body) 0%, white 100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-weight: 600;
    color: var(--primary-dark);
}

.modal-body {
    padding: 1.75rem;
}

.modal-footer {
    padding: 1.25rem 1.75rem;
    border-top: 1px solid #e5e7eb;
    background: var(--bg-body);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.hover-bg-light:hover {
    background-color: #f9fafb !important;
    transition: var(--transition-fast);
}

/* --- Mobile Topbar --- */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding: 0 1.5rem;
    z-index: 999;
    align-items: center;
    justify-content: space-between;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* --- Utility Classes --- */
.fw-bold {
    font-weight: 600 !important;
}

.fw-medium {
    font-weight: 500 !important;
}

.text-gold {
    color: var(--accent-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.shadow-premium {
    box-shadow: var(--shadow-premium) !important;
}

.rounded-pill {
    border-radius: 50rem !important;
}

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

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 1rem;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 0.25rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mb-5 {
    margin-bottom: 3rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.mt-auto {
    margin-top: auto !important;
}

.p-3 {
    padding: 1rem !important;
}

.p-4 {
    padding: 1.5rem !important;
}

.p-5 {
    padding: 3rem !important;
}

.py-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.w-100 {
    width: 100% !important;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    .mobile-topbar {
        display: flex !important;
    }

    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0 !important;
        padding-top: 90px !important;
        transition: var(--transition-slow);
    }

    .card-body,
    .modal-body {
        padding: 1.25rem;
    }

    .table thead th,
    .table tbody td {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .calendar-card {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .btn-sm {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }
}