/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables */
:root {
    --primary-color: #2c5aa0;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 300ms ease-in-out;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Admin Layout */
.admin-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

.admin-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 var(--space-lg);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.admin-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.admin-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.admin-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
}

.admin-user i {
    font-size: 1.5rem;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-logout:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Sidebar */
.admin-sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 250px;
    height: calc(100vh - 70px);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.admin-menu {
    padding: var(--space-lg) 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.menu-item.active {
    background: var(--bg-secondary);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.menu-item i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.admin-main {
    margin-left: 250px;
    margin-top: 70px;
    padding: var(--space-xl);
    min-height: calc(100vh - 70px);
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

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

.section-header p {
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

.section-actions {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    padding: var(--space-sm) var(--space-md);
    padding-right: var(--space-2xl);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    width: 250px;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.search-box i {
    position: absolute;
    right: var(--space-md);
    color: var(--text-muted);
    pointer-events: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--secondary-color);
    color: white;
}

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

.badge-warning {
    background-color: var(--warning-color);
    color: #fff;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}

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

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--bg-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    transition: all var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Dashboard Charts */
.dashboard-charts {
    display: grid;
    gap: var(--space-lg);
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.chart-card {
    background: var(--bg-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    height: 600px;
}

.chart-card h3 {
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
    text-align: center;
}

.chart-card canvas {
    max-width: 100%;
    width: 100% !important;
    height: 300px !important;
}

/* Specific heights for different chart types */
.chart-card:has(#monthlyChart),
.chart-card.monthly-chart {
    height: 400px;
}

.chart-card:has(#categoryChart),
.chart-card:has(#priceChart),
.chart-card.category-chart,
.chart-card.price-chart {
    height: 450px;
}

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

.chart-placeholder {
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
}

.chart-placeholder i {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.admin-table td {
    color: var(--text-secondary);
}

.admin-table tr:hover {
    background: var(--bg-secondary);
}

.product-name {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.product-name small {
    color: var(--text-muted);
    font-size: 0.75rem;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    display: inline-block;
    margin-right: var(--space-xs);
}

.price-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.price-info small {
    font-size: 0.75rem;
    font-weight: 600;
}

.blog-title {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.blog-title small {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.user-info small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.user-info small i {
    margin-right: var(--space-xs);
}

.category-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.category-info .category-name {
    font-weight: 500;
    color: var(--text-primary);
}

.category-info .category-type {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    display: inline-block;
    width: fit-content;
}

.category-info .parent-info {
    color: var(--text-secondary);
    font-size: 0.7rem;
    margin-top: var(--space-xs);
}

/* Category hierarchy styling */
.category-root {
    background: rgba(44, 90, 160, 0.05);
    font-weight: 600;
}

.category-main {
    background: rgba(16, 185, 129, 0.05);
}

.category-main .category-name {
    padding-left: var(--space-md);
}

.category-sub {
    background: rgba(245, 158, 11, 0.05);
}

.category-sub .category-name {
    padding-left: var(--space-xl);
}

/* Product count styling */
.product-count {
    font-weight: 600;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.product-count.has-products {
    background: var(--success-color);
    color: white;
}

.product-count.no-products {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

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

.text-error {
    color: var(--error-color);
}

.text-success {
    color: var(--success-color);
}

/* Contact Management Styles */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}

.status-new {
    background-color: #3b82f6;
    color: white;
}

.status-in_progress {
    background-color: #f59e0b;
    color: white;
}

.status-completed {
    background-color: #10b981;
    color: white;
}

.status-spam {
    background-color: #ef4444;
    color: white;
}

.truncate-text {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-link, .phone-link {
    color: var(--primary-color);
    text-decoration: none;
}

.email-link:hover, .phone-link:hover {
    text-decoration: underline;
}

.filter-dropdown {
    position: relative;
}

.filter-dropdown select {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-dropdown select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.pagination-container {
    margin-top: var(--space-lg);
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: var(--space-xs);
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(.disabled) {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
}

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

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Contact Detail Modal Styles */
.contact-detail-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.contact-info-section,
.contact-message-section,
.contact-meta-section {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border: 1px solid var(--border-color);
}

.contact-info-section h4,
.contact-message-section h4,
.contact-meta-section h4 {
    margin-bottom: var(--space-md);
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--space-sm);
}

.contact-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.info-item label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-item p {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.full-width {
    grid-column: 1 / -1;
}

.message-content {
    background-color: var(--bg-primary);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    min-height: 100px;
    white-space: pre-wrap;
    font-size: 0.875rem;
    line-height: 1.6;
}

.meta-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.status-control {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.status-control label {
    font-weight: 500;
    color: var(--text-primary);
}

.status-control select {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: var(--space-md);
}

.sort-badge {
    display: inline-block;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 30px;
    text-align: center;
}

/* Product Table Enhancements */
.product-name {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.product-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.employee-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.product-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.detail-badge {
    display: inline-block;
    padding: 2px 6px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.contact-item i {
    width: 10px;
    font-size: 0.6rem;
}

/* Employee Image Input */
.employee-image-input {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.employee-preview {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.employee-preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.employee-preview-item img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.employee-preview-item .loading {
    color: var(--text-muted);
    font-style: italic;
}

.text-error {
    color: var(--error-color);
    font-size: 0.75rem;
}

/* Sample URL buttons */
.sample-urls {
    margin: var(--space-sm) 0;
}

.url-samples {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
}

.btn-sample {
    padding: 4px 8px;
    font-size: 0.7rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* User Table Enhancements */
.user-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.user-phone {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.user-phone i {
    width: 10px;
    font-size: 0.6rem;
}

/* Modal Styles */
.modal-backdrop {
    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: 10000;
    padding: var(--space-lg);
}

.modal-dialog {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: auto;
}

.modal-dialog.modal-lg {
    max-width: 900px;
    max-height: 95vh;
}

.modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    max-height: calc(95vh - 140px);
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky; 
    bottom: 0; 
    z-index: 10;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input[type="number"] {
    text-align: right;
}

/* Required field indicator */
.form-group label:has(+ input[required])::after,
.form-group label:has(+ select[required])::after,
.form-group label:has(+ textarea[required])::after {
    content: ' *';
    color: var(--error-color);
}

/* Image Manager Styles */
.image-manager {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    background: var(--bg-secondary);
}

.image-url-input {
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
}

.input-group {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.input-group .form-control {
    flex: 1;
    margin-bottom: 0;
}

.input-group .btn {
    white-space: nowrap;
}

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

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.preview-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all var(--transition-fast);
}

.preview-item .remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.existing-images h4 {
    margin-bottom: var(--space-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
}

.image-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.image-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.image-item .image-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
}

.image-item .action-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all var(--transition-fast);
}

.image-item .action-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.image-item .action-btn.delete {
    background: rgba(239, 68, 68, 0.8);
}

.image-item .action-btn.delete:hover {
    background: rgba(239, 68, 68, 1);
}

.image-item .action-btn.view {
    background: rgba(59, 130, 246, 0.8);
}

.image-item .action-btn.view:hover {
    background: rgba(59, 130, 246, 1);
}

.image-item .image-info {
    padding: var(--space-sm);
    background: var(--bg-primary);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.image-item .image-name {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-item .image-id {
    font-size: 0.7rem;
    opacity: 0.8;
}

.no-images {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: var(--space-xl);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-xl);
}

.setting-card {
    background: var(--bg-primary);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.setting-card h3 {
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
}

/* Forms */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

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

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }
    
    .admin-sidebar.open {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .section-actions {
        flex-direction: column;
        width: 100%;
        gap: var(--space-md);
    }

    .search-input {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .chart-card {
        height: auto;
    }

    .chart-card:has(#monthlyChart),
    .chart-card.monthly-chart {
        height: 300px;
    }

    .chart-card:has(#categoryChart),
    .chart-card:has(#priceChart),
    .chart-card.category-chart,
    .chart-card.price-chart {
        height: 280px;
    }

    .chart-wrapper {
        height: 250px;
    }

    .admin-table {
        font-size: 0.75rem;
    }

    .admin-table th,
    .admin-table td {
        padding: var(--space-sm);
    }
}

/* Advanced Filters */
.filters-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.filters-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-fast);
}

.filters-header:hover {
    background: var(--bg-secondary);
}

.filters-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

.filters-header h3 > div {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-toggle.collapsed i {
    transform: rotate(-90deg);
}

.filters-content {
    padding: var(--space-lg);
    transition: all var(--transition-normal);
}

.filters-content.collapsed {
    display: none;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.filter-group input,
.filter-group select {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
    color: var(--text-primary);
    max-width: 100%;
    box-sizing: border-box;
}

/* Sửa lỗi tràn cho các ô input số */
.filter-group input[type="number"] {
    max-width: 120px;
}

/* Đảm bảo các filter group không bị tràn */
.filter-group {
    min-width: 150px;
    flex: 1 1 auto;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.price-range,
.area-range {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.price-range input,
.area-range input {
    flex: 1;
}

.price-range span,
.area-range span {
    color: var(--text-muted);
    font-weight: 500;
}

.filter-actions {
    display: flex;
    gap: var(--space-sm);
}

.filter-actions .btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
}

/* Enhanced Section Actions */
.section-actions {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

.section-actions .btn {
    white-space: nowrap;
}

/* Table Header */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.bulk-select {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.bulk-select input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.bulk-select label {
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    margin: 0;
    font-size: 0.875rem;
}

.table-info {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.table-info span {
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* Enhanced Table */
.admin-table th:first-child,
.admin-table td:first-child {
    text-align: center;
    width: 40px;
}

.admin-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.admin-table tr.selected {
    background-color: rgba(44, 90, 160, 0.1) !important;
}

.admin-table tr:hover {
    background-color: var(--bg-secondary);
}

/* Button Variants */
.btn-info {
    background-color: #0ea5e9;
    color: white;
}

.btn-info:hover {
    background-color: #0284c7;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Quick Add Modal */
.quick-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.quick-add-item {
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-add-item:hover {
    border-color: var(--primary-color);
    background: rgba(44, 90, 160, 0.05);
    transform: translateY(-2px);
}

.quick-add-item i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: var(--space-md);
}

.quick-add-item h4 {
    margin: 0 0 var(--space-xs) 0;
    color: var(--text-primary);
    font-weight: 600;
}

.quick-add-item p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Bulk Edit Modal */
.bulk-edit-info {
    background: rgba(44, 90, 160, 0.1);
    border: 1px solid rgba(44, 90, 160, 0.2);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.bulk-edit-info p {
    margin: 0;
    color: var(--primary-color);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.bulk-field {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.field-header {
    background: var(--bg-secondary);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    user-select: none;
}

.field-header:hover {
    background: var(--bg-tertiary);
}

.field-header input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.field-header label {
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    margin: 0;
    flex: 1;
}

.field-content {
    padding: var(--space-md);
    background: var(--bg-primary);
}

.field-content input:disabled,
.field-content select:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.field-content input:not(:disabled),
.field-content select:not(:disabled) {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Form Row for Bulk Edit */
.bulk-field .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.bulk-field .form-group {
    margin-bottom: 0;
}

.bulk-field .form-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

/* Bulk Employee Image Upload */
.employee-image-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-top: var(--space-md);
    transition: all var(--transition-fast);
}

.employee-image-upload.drag-over {
    border-color: var(--primary-color);
    background: rgba(44, 90, 160, 0.05);
}

.upload-methods {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.upload-method {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-secondary);
    min-width: 200px;
}

.upload-label:hover {
    border-color: var(--primary-color);
    background: rgba(44, 90, 160, 0.05);
}

.upload-label i {
    font-size: 2rem;
    color: var(--primary-color);
}

.upload-label span {
    font-weight: 500;
    color: var(--text-primary);
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
}

.upload-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.upload-divider::before,
.upload-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.url-input-group {
    display: flex;
    gap: var(--space-sm);
    width: 100%;
    max-width: 400px;
}

.url-input-group input {
    flex: 1;
}

.btn-preview {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-preview:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* Image Preview for Bulk Edit */
.image-preview {
    margin-top: var(--space-md);
}

.image-preview-item {
    position: relative;
    display: inline-block;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.image-preview-item img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    display: block;
}

.image-actions {
    position: absolute;
    top: var(--space-xs);
    right: var(--space-xs);
    display: flex;
    gap: var(--space-xs);
}

.btn-remove {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all var(--transition-fast);
}

.btn-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.preview-error {
    width: 120px;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    gap: var(--space-xs);
}

/* Upload Progress */
.upload-progress {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    animation: progressAnimation 2s ease-in-out infinite;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

@keyframes progressAnimation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Responsive for bulk image upload */
@media (max-width: 768px) {
    .upload-methods {
        gap: var(--space-md);
    }

    .upload-label {
        min-width: 150px;
        padding: var(--space-md);
    }

    .url-input-group {
        max-width: 100%;
    }

    .image-preview-item img {
        width: 100px;
        height: 100px;
    }

    .preview-error {
        width: 100px;
        height: 100px;
    }
}
