/* =========================================
   HomeView - Glassmorphism & Bento UI Styles
   ========================================= */

:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --danger-color: #f56565;
    --info-color: #4299e1;
    
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-bg-light: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    
    --sidebar-width: 220px;
    --header-height: 50px;
    
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-light: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.7);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
}

/* Glassmorphism Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    isolation: isolate;
}

.glass-card:hover {
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.25);
}

.glass-card-light {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--glass-shadow);
    padding: 1rem;
    isolation: isolate;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
    isolation: isolate;
}

.sidebar-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-header i {
    font-size: 1.5rem;
}

.sidebar-nav {
    flex: 1;
    list-style: none;
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
}

.sidebar-nav .nav-item {
    margin-bottom: 0.25rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.sidebar-nav .nav-link:hover {
    background: var(--glass-bg-light);
}

.sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 500;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--glass-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--glass-bg-light);
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: white;
    font-weight: 500;
    font-size: 0.85rem;
}

.user-role {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: capitalize;
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(245, 101, 101, 0.2);
    color: #fed7d7;
    border: 1px solid rgba(245, 101, 101, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(245, 101, 101, 0.4);
    color: white;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 1rem;
    transition: margin-left 0.3s ease;
}

.page-content {
    max-width: 1400px;
    margin: 0 auto;
}

/* Mobile Header */
.mobile-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    z-index: 100;
    isolation: isolate;
}

.mobile-header .btn-link {
    color: white;
    font-size: 1.25rem;
    padding: 0.25rem;
}

.header-title {
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

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

/* Bento Grid */
.bento-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.bento-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.bento-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Stats Cards */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.stat-icon.primary {
    background: rgba(102, 126, 234, 0.3);
    color: #a3bffa;
}

.stat-icon.success {
    background: rgba(72, 187, 120, 0.3);
    color: #9ae6b4;
}

.stat-icon.warning {
    background: rgba(237, 137, 54, 0.3);
    color: #fbd38d;
}

.stat-icon.danger {
    background: rgba(245, 101, 101, 0.3);
    color: #feb2b2;
}

.stat-icon.info {
    background: rgba(66, 153, 225, 0.3);
    color: #90cdf4;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.125rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-title {
    color: white;
    font-size: 1.35rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-title i {
    font-size: 1.25rem;
}

/* Buttons */
.btn-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    isolation: isolate;
}

.btn-glass:hover {
    background: var(--glass-bg-light);
    color: white;
    transform: translateY(-1px);
}

.btn-glass-primary {
    background: rgba(102, 126, 234, 0.4);
    border-color: rgba(102, 126, 234, 0.5);
}

.btn-glass-primary:hover {
    background: rgba(102, 126, 234, 0.6);
}

.btn-glass-success {
    background: rgba(72, 187, 120, 0.4);
    border-color: rgba(72, 187, 120, 0.5);
}

.btn-glass-success:hover {
    background: rgba(72, 187, 120, 0.6);
}

.btn-glass-danger {
    background: rgba(245, 101, 101, 0.4);
    border-color: rgba(245, 101, 101, 0.5);
}

.btn-glass-danger:hover {
    background: rgba(245, 101, 101, 0.6);
}

/* Tables */
.table-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
}

.table-glass {
    width: 100%;
    margin: 0;
    font-size: 0.875rem;
}

.table-glass thead th {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    font-weight: 600;
    padding: 0.625rem 0.75rem;
    border: none;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.table-glass tbody td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    vertical-align: middle;
}

.table-glass tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

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

/* Badges */
.badge-glass {
    padding: 0.25rem 0.5rem;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(72, 187, 120, 0.2);
    color: #276749;
}

.badge-warning {
    background: rgba(237, 137, 54, 0.2);
    color: #c05621;
}

.badge-danger {
    background: rgba(245, 101, 101, 0.2);
    color: #c53030;
}

.badge-info {
    background: rgba(66, 153, 225, 0.2);
    color: #2b6cb0;
}

/* Forms */
.form-glass {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--glass-shadow);
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.form-control, .form-select {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Modals */
.modal-content {
    background: #fff;
    border-radius: 16px;
    border: none;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 1.25rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.modal-body {
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1.25rem;
}

/* Action Buttons */
.btn-action {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.btn-action-edit {
    background: rgba(66, 153, 225, 0.1);
    color: var(--info-color);
}

.btn-action-edit:hover {
    background: rgba(66, 153, 225, 0.2);
    color: var(--info-color);
}

.btn-action-delete {
    background: rgba(245, 101, 101, 0.1);
    color: var(--danger-color);
}

.btn-action-delete:hover {
    background: rgba(245, 101, 101, 0.2);
    color: var(--danger-color);
}

.btn-action-warning {
    background: rgba(237, 137, 54, 0.1);
    color: var(--warning-color);
}

.btn-action-warning:hover {
    background: rgba(237, 137, 54, 0.2);
    color: var(--warning-color);
}

.btn-action-view {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success-color);
}

.btn-action-view:hover {
    background: rgba(72, 187, 120, 0.2);
    color: var(--success-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 0.75rem;
}

.empty-state h5 {
    margin-bottom: 0.375rem;
    color: var(--text-primary);
    font-size: 1rem;
}

/* Loading */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 0.25rem;
}

/* View Transitions */
@view-transition {
    navigation: auto;
}

::view-transition-old(page-content) {
    animation: fade-out 0.15s ease-out forwards;
}

::view-transition-new(page-content) {
    animation: fade-in 0.15s ease-in forwards;
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

#pageContent {
    view-transition-name: page-content;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0.75rem;
    }
    
    .bento-grid-3,
    .bento-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767.98px) {
    /* Hide table on mobile, show list */
    .table-container {
        display: none;
    }
    
    .mobile-list {
        display: block !important;
    }
    
    .glass-card {
        padding: 0.75rem;
        border-radius: 10px;
    }
    
    .page-header {
        margin-bottom: 0.75rem;
    }
    
    .page-title {
        font-size: 1.15rem;
    }
    
    .btn-glass {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .bento-grid {
        gap: 0.5rem;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
}

@media (max-width: 575.98px) {
    .bento-grid,
    .bento-grid-3,
    .bento-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Mobile List Styles */
.mobile-list {
    display: none;
}

.mobile-list-item {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--glass-shadow);
}

.mobile-list-item:last-child {
    margin-bottom: 0;
}

.mobile-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.mobile-list-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.mobile-list-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.mobile-list-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
    font-size: 0.8rem;
}

.mobile-list-row {
    display: flex;
    flex-direction: column;
}

.mobile-list-label {
    color: var(--text-secondary);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mobile-list-value {
    color: var(--text-primary);
    font-weight: 500;
}

.mobile-list-actions {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0,0,0,0.05);
    flex-wrap: wrap;
}

.mobile-list-actions .btn-action {
    flex: 1;
    min-width: 0;
    height: 32px;
    width: auto;
}

/* Utilities */
.text-white {
    color: white !important;
}

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

.mt-section {
    margin-top: 1.25rem;
}

.currency::before {
    content: '';
}

.currency::after {
    content: ' ₫';
}
