/* VV Clinic - Premium Luxury Theme & Design System */

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

:root {
    --bg-main: #0a0a0e;
    --bg-sidebar: #101015;
    --bg-card: rgba(22, 22, 30, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    
    /* Luxury Gold & Rose Gold Gradients */
    --primary-gold: #d4af37;
    --secondary-gold: #aa7c11;
    --rose-gold: #e5a9a9;
    --accent-gradient: linear-gradient(135deg, #e5a9a9 0%, #d4af37 100%);
    --button-gradient: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    --card-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Semantic Colors */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
    overflow-x: hidden;
    height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-gold);
}

/* --- Layout --- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.sidebar-logo h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.menu-item.active {
    background: var(--accent-gradient);
    color: #0b0b0f;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.25);
}

.menu-item.active i {
    color: #0b0b0f !important;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: rgba(16, 16, 21, 0.8);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.top-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-reset-db {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-reset-db:hover {
    border-color: var(--primary-gold);
    color: var(--primary-gold);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-gradient);
    padding: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.user-avatar span {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-sidebar);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--rose-gold);
}

/* App View Wrapper */
.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    animation: fadeIn 0.4s ease;
}

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

/* --- UI Components --- */

/* Glassmorphism Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-glow);
    backdrop-filter: blur(12px);
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    transition: background 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(212, 175, 55, 0.25);
}

.card:hover::before {
    background: var(--accent-gradient);
}

.card-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Inputs & Form Controls */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

select.form-control {
    background-color: #0a0a0e;
}

select.form-control option, select.form-control optgroup {
    background-color: #0a0a0e;
    color: #fff;
}

.form-control:focus {
    border-color: var(--primary-gold);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

select.form-control:focus {
    background-color: #0a0a0e;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--button-gradient);
    color: #0b0b0f;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: rgba(255, 255, 255, 0.02);
    padding: 16px 24px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 16px 24px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

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

tr:hover td {
    background: rgba(255, 255, 255, 0.015);
}

/* Badges / Status tags */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-info {
    background: rgba(59, 130, 246, 0.12);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-gold {
    background: rgba(212, 175, 55, 0.12);
    color: var(--primary-gold);
    border: 1px solid rgba(212, 175, 55, 0.2);
}

/* --- Section Layouts --- */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.view-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Noto Sans Thai', sans-serif;
}

.search-bar-container {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

/* --- Chart styling --- */
.chart-container {
    height: 300px;
    position: relative;
    width: 100%;
}

/* --- Grid styles --- */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -12px;
    margin-left: -12px;
}

.col-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
    padding: 12px;
}

.col-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
    padding: 12px;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 12px;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding: 12px;
}

@media (max-width: 992px) {
    .col-8, .col-4, .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .sidebar {
        width: 70px;
    }
    .sidebar-logo h1, .menu-item span {
        display: none;
    }
    .sidebar-logo {
        padding: 0;
        justify-content: center;
    }
}
