/* ----------------------------
   CSS Variables & Theming
----------------------------- */
:root {
    /* Colors */
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --primary-light: #e0f2fe;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #0f172a;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;

    /* Typography */
    --font-family: 'Inter', sans-serif;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);

    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;

    --transition: all 0.2s ease-in-out;
}

/* ----------------------------
   CSS Resets
----------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
}

/* ----------------------------
   Utility Classes
----------------------------- */
.hidden {
    display: none !important;
}

.w-full {
    width: 100%;
}

.text-center {
    text-align: center;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--gray-900);
    font-weight: 600;
}

/* ----------------------------
   Buttons
----------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ----------------------------
   Forms
----------------------------- */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--gray-900);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

/* Alert Box */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    text-align: center;
}

.alert.error {
    background-color: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert.success {
    background-color: #f0fdf4;
    color: var(--secondary);
    border: 1px solid #bbf7d0;
}

/* ----------------------------
   Authentication Page (index.html)
----------------------------- */
.auth-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--gray-100);
}

.auth-container {
    width: 100%;
    max-width: 900px;
    height: 600px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    overflow: hidden;
    margin: 1rem;
}

.auth-decoration {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--white);
    overflow: hidden;
}

.auth-decoration .brand h1 {
    color: var(--white);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    z-index: 2;
    position: relative;
}

.auth-decoration .brand h1 span {
    color: var(--secondary);
}

.auth-decoration .brand p {
    font-size: 1.125rem;
    opacity: 0.9;
    z-index: 2;
    position: relative;
}

.shape {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: -50px;
    left: -100px;
}

.shape-2 {
    width: 400px;
    height: 400px;
    bottom: -150px;
    right: -100px;
}

.auth-form-wrapper {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--white);
}

.auth-toggle {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    margin-bottom: 2rem;
}

.auth-toggle button {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    background: transparent;
    border-radius: var(--radius-sm);
}

.auth-toggle button.active {
    background: var(--white);
    color: var(--gray-900);
    box-shadow: var(--shadow-sm);
}

.auth-box h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-box .subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .auth-decoration {
        display: none;
    }
}

/* ----------------------------
   Layout & Dashboard
----------------------------- */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    color: var(--white);
    font-size: 1.5rem;
    margin: 0;
}

.sidebar-header h2 span {
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.sidebar-nav a {
    display: block;
    padding: 0.875rem 1.5rem;
    color: var(--gray-300);
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    border-left: 4px solid var(--primary);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info p {
    font-weight: 600;
    color: var(--white);
    margin-bottom: 0.25rem;
}

.user-info small {
    display: block;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--gray-600);
    color: var(--gray-300);
    width: 100%;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
}

.topbar {
    height: 70px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

.topbar h1 {
    font-size: 1.25rem;
    color: var(--gray-800);
    margin: 0;
}

.content-area {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

/* ----------------------------
   Stats & Cards
----------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* ----------------------------
   Tables & Badges
----------------------------- */
.table-container {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

th {
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    color: var(--gray-700);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--gray-50);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending {
    background: #fef3c7;
    color: #b45309;
}

.badge-completed {
    background: #d1fae5;
    color: #047857;
}

.badge-scheduled {
    background: #e0f2fe;
    color: #0284c7;
}

.badge-canceled {
    background: #fee2e2;
    color: #b91c1c;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* ----------------------------
   Modals
----------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.large {
    max-width: 800px;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--gray-900);
}

/* AI / Chat Box */
.ai-response-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.ai-response-box h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.ai-response-box ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}