/* assets/css/style.css */

:root {
    --primary: #13294b;
    --primary-dark: #0a1526;
    --primary-light: #f8fafc;
    --secondary: #64748b;
    --success: #208638;
    --bg-success: #d2e7d7;
    --danger: #d82f3b;
    --bg-danger: #f7d5d8;
    --warning: #73520d;
    --bg-warning: #fceac5;
    --bg-body: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-grid: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --header-height: 55px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md:
        0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg:
        0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.2s ease;
}

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

body {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-title {
    padding: 10px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    margin: 2px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item svg {
    flex-shrink: 0;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-nav {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 110;
}

.menu-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.user-dropdown-btn:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: var(--transition);
    z-index: 200;
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-header strong {
    font-size: 14px;
    color: var(--text-primary);
}

.dropdown-header span {
    font-size: 12px;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

.dropdown-item {
    display: block;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.dropdown-item:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

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

.dropdown-item.text-danger:hover {
    background: #fef2f2;
}

/* Page content */
.page-content {
    padding: 24px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-md);
}

.page-tab {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.page-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: #f8fafc;
}

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

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

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 14px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.stat-values {
    display: flex;
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Date navigator */
.date-navigator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.date-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    flex: 1;
}

/* Grid table */
.reservation-grid-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.reservation-grid {
    display: grid;
    overflow-x: auto;
}

.grid-header {
    display: contents;
}

.grid-header-cell {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.grid-time-label {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    background: #f8fafc;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-cell {
    padding: 10px 8px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    min-height: 73px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.grid-cell:last-child {
    border-right: none;
}

.grid-cell.available {
    background: white;
    color: var(--text-muted);
}

.grid-cell.available:hover {
    background: var(--primary-light);
}

.grid-cell.booked {
    background: #334155;
    color: white;
    cursor: default;
}

.grid-cell.booked:hover {
    background: #1e293b;
}

.grid-cell.booked[draggable="true"] {
    cursor: grab;
}

.grid-cell.booked.dragging {
    opacity: 0.25;
    transform: scale(0.97);
    transition: none;
}

.grid-cell.available.drag-over {
    background: var(--primary-light);
    box-shadow: inset 0 0 0 2px var(--primary);
    transition: none;
}

.grid-cell.blocked {
    background: #f7d5d8;
    color: #d82f3b;
    cursor: default;
}

.grid-cell.blocked {
    .grid-cell-time {
        color: #d82f3b;
    }
}

.grid-cell-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-weight: 500;
}

.grid-cell-status {
    font-size: 12px;
    font-weight: 500;
}

.grid-cell-user {
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
}

.grid-cell-type {
    font-size: 10px;
    opacity: 0.8;
    margin-top: 2px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control,
.form-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    background: white;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.form-select {
    cursor: pointer;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.form-check-input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.form-check-label {
    font-size: 13px;
    color: var(--text-secondary);
}

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

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    background: #f8fafc;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 20px;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.96);
    transition: var(--transition);
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 12px 20px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    border: 1px solid var(--primary);
    animation: slideIn 0.3s ease;
}

.toast.success {
    background-color: var(--bg-success);
    color: var(--success);
    border-color: var(--success);
}

.toast.error {
    background-color: var(--bg-danger);
    color: var(--danger);
    border-color: var(--danger);
}

.toast.warning {
    background-color: var(--bg-warning);
    color: var(--warning);
    border-color: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Login page */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff 0%, #f1f5f9 100%);
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 32px;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.auth-logo span {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-img {
    max-height: 28px;
    width: auto;
    object-fit: contain;
}

.auth-logo .logo-img {
    max-height: 32px;
}

.logo-preview {
    max-height: 80px;
    max-width: 200px;
    width: auto;
    object-fit: contain;
}

.auth-title {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
}

/* Achievements */
.achievements-badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 20px 0;
}

.achievement-badge-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 120px;
}

.achievement-badge {
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.achievement-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.achievement-badge-wrapper.locked .achievement-badge img {
    filter: grayscale(100%);
}

.achievement-badge-wrapper.locked .achievement-badge svg {
    color: var(--text-muted);
}

.achievement-tooltip {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 12px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    text-align: center;
}

.achievement-badge-wrapper:hover .achievement-tooltip {
    opacity: 1;
    visibility: visible;
}

.achievement-tooltip::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-color);
}

.achievement-tooltip-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.achievement-tooltip-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.achievement-tooltip-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Responsive */
@media (min-width: 769px) {
    .menu-toggle {
        display: none;
    }
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 16px;
    }

    .date-title {
        font-size: 16px;
        order: -1;
        width: 100%;
    }

    .date-navigator {
        flex-direction: column;
        align-items: stretch;
    }

    .date-navigator .btn {
        justify-content: center;
    }
}

/* Utility */
.text-center {
    text-align: center;
}
.text-right {
    text-align: right;
}
.text-muted {
    color: var(--text-muted);
}
.text-success {
    color: var(--success);
}
.text-danger {
    color: var(--danger);
}
.text-primary {
    color: var(--primary);
}
.mb-0 {
    margin-bottom: 0;
}
.mb-1 {
    margin-bottom: 4px;
}
.mb-2 {
    margin-bottom: 8px;
}
.mb-3 {
    margin-bottom: 12px;
}
.mb-4 {
    margin-bottom: 16px;
}
.mb-5 {
    margin-bottom: 24px;
}
.mt-3 {
    margin-top: 12px;
}
.mt-4 {
    margin-top: 16px;
}
.d-flex {
    display: flex;
}
.align-center {
    align-items: center;
}
.justify-between {
    justify-content: space-between;
}
.gap-2 {
    gap: 8px;
}
.gap-3 {
    gap: 12px;
}
.w-100 {
    width: 100%;
}
.flex-wrap {
    flex-wrap: wrap;
}
