/* ========================================
   PortalRental Design System - CSS Variables
   ======================================== */
:root {
    /* Primary Palette */
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #4a90e2;
    --primary-glow: rgba(26, 115, 232, 0.25);

    /* Accent */
    --accent: #00c9a7;
    --accent-dark: #00a88a;
    --accent-light: #5dfdd9;

    /* Light Theme */
    --bg-darkest: #f1f5f9;
    --bg-dark: #e2e8f0;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-surface: #ffffff;
    --bg-input: #f8fafc;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-white: #ffffff;

    /* Status */
    --success: #00c853;
    --warning: #ffab00;
    --danger: #ff5252;
    --info: #40c4ff;

    /* Borders */
    --border-color: #cbd5e1;
    --border-light: #94a3b8;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 30px rgba(26, 115, 232, 0.15);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 60px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ========================================
   Global Reset & Base
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

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

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: var(--font-family);
}

input, select, textarea {
    font-family: var(--font-family);
    outline: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========================================
   Utility Classes
   ======================================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::after {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(26, 115, 232, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #00a844);
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.3);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 200, 83, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #d32f2f);
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(255, 82, 82, 0.3);
}
.btn-danger:hover {
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #e69500);
    color: #1a1a1a;
    box-shadow: 0 4px 15px rgba(255, 171, 0, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: var(--bg-card);
    border-color: var(--primary);
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* ========================================
   Form Inputs
   ======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition-normal);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b9dc3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ========================================
   Data Table
   ======================================== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.data-table thead th {
    background: var(--bg-surface);
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--primary);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

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

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

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

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card.blue::before { background: var(--primary); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.cyan::before { background: var(--info); }
.stat-card.purple::before { background: #a855f7; }

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-light);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card.blue .stat-icon { background: rgba(26, 115, 232, 0.15); color: var(--primary); }
.stat-card.green .stat-icon { background: rgba(0, 200, 83, 0.15); color: var(--success); }
.stat-card.orange .stat-icon { background: rgba(255, 171, 0, 0.15); color: var(--warning); }
.stat-card.cyan .stat-icon { background: rgba(64, 196, 255, 0.15); color: var(--info); }
.stat-card.purple .stat-icon { background: rgba(168, 85, 247, 0.15); color: #a855f7; }

.stat-info h3 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn var(--transition-fast);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp var(--transition-slow);
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

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

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    box-shadow: var(--shadow-md);
    animation: slideInRight var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.toast.success { background: linear-gradient(135deg, #00c853, #00a844); }
.toast.error { background: linear-gradient(135deg, #ff5252, #d32f2f); }
.toast.warning { background: linear-gradient(135deg, #ffab00, #e69500); }
.toast.info { background: linear-gradient(135deg, #40c4ff, #0091ea); }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    animation: progressShrink 3s linear forwards;
}

/* ========================================
   Status Badges
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: rgba(0, 200, 83, 0.15); color: var(--success); }
.badge-warning { background: rgba(255, 171, 0, 0.15); color: var(--warning); }
.badge-danger { background: rgba(255, 82, 82, 0.15); color: var(--danger); }
.badge-info { background: rgba(64, 196, 255, 0.15); color: var(--info); }
.badge-primary { background: rgba(26, 115, 232, 0.15); color: var(--primary); }

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

@keyframes progressShrink {
    from { width: 100%; }
    to { width: 0%; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Page content animation */
.page-enter {
    animation: fadeSlideIn var(--transition-slow);
}

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

/* Cover image in table */
.cover-thumb {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

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

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Search box */
.search-box {
    position: relative;
    max-width: 320px;
}

.search-box input {
    padding-left: 40px;
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-info h3 {
        font-size: 1.3rem;
    }

    .modal {
        width: 95%;
        max-height: 90vh;
    }
}
