/* TheClayAura Admin Panel - Common CSS */

:root {
    --primary-color: #84443A;
    --primary-dark: #6e372f;
    --secondary-color: #f8fafc;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark theme variables */
[data-theme="dark"] {
    --secondary-color: #0b0f14;
    --light-color: #111827;
    --border-color: #1f2937;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.5);
}

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

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

/* Dark adjustments for common surfaces */
[data-theme="dark"] body { background-color: var(--secondary-color); }
[data-theme="dark"] .sidebar { background: var(--light-color); border-color: var(--border-color); }
[data-theme="dark"] .nav-link { color: var(--text-secondary); }
[data-theme="dark"] .nav-link:hover, [data-theme="dark"] .nav-link.active { color: var(--light-color); }
[data-theme="dark"] .main-content { background: var(--secondary-color); }
[data-theme="dark"] .card { background: var(--light-color); }
[data-theme="dark"] .table { background: var(--light-color); }
[data-theme="dark"] .table th { background: var(--secondary-color); }
[data-theme="dark"] .table tbody tr:hover { background: var(--secondary-color); }
[data-theme="dark"] .user-info { background: var(--secondary-color); }
[data-theme="dark"] .modal-content { background: var(--light-color); }
/* Dark adjustments for tabs and filters */
[data-theme="dark"] .tabs { border-color: var(--border-color); }
[data-theme="dark"] .tabs .tab { background: #1f2937; color: var(--text-primary); border: 1px solid var(--border-color); }
[data-theme="dark"] .tabs .tab:hover { background: #111827; }
[data-theme="dark"] .tabs .tab.active { background: var(--primary-color); color: #ffffff; border-color: var(--primary-color); }
[data-theme="dark"] .flag-filters { background: var(--light-color); border-color: var(--border-color); }
[data-theme="dark"] .flag-filters .flag { background: #1f2937; color: var(--text-primary); border: 1px solid var(--border-color); }
[data-theme="dark"] .flag-filters .flag.active { background: var(--primary-color); color: #ffffff; border-color: var(--primary-color); }

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-card {
    background: var(--light-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--primary-color);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Main Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--light-color);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
}

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

.sidebar-header h2 {
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 700;
}

.sidebar-nav {
    padding: 20px 0;
}

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

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 12px;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-color);
    color: var(--light-color);
}

/* Ensure readable text on primary backgrounds */
.bg-primary { background: var(--primary-color) !important; color: #ffffff !important; }
.btn-primary, .nav-link.active, .tabs .tab.active, .pagination .active { color: #ffffff !important; }
.btn-primary i, .nav-link.active i, .tabs .tab.active i { color: #ffffff !important; }

.nav-link i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 20px;
}

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

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

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--secondary-color);
    border-radius: 8px;
}

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

/* Cards */
.card {
    background: var(--light-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--light-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-title {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.stat-icon.users {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-icon.orders {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.stat-icon.products {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-icon.revenue {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-change {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--light-color);
    border-radius: 8px;
    overflow: hidden;
}

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

.table th {
    background: var(--secondary-color);
    font-weight: 600;
    color: var(--text-primary);
}

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

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-info {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.badge-secondary {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-secondary);
}

/* Forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(132, 68, 58, 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    gap: 8px;
}

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

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

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

.btn-warning {
    background: var(--warning-color);
    color: var(--light-color);
}

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

.btn-secondary {
    background: var(--text-secondary);
    color: var(--light-color);
}

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

.btn-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

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

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

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--light-color);
    color: var(--text-primary);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: var(--primary-color);
    color: var(--light-color);
    border-color: var(--primary-color);
}

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

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

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

.text-sm {
    font-size: 14px;
}

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

.mt-4 {
    margin-top: 16px;
}

.hidden {
    display: none !important;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
}

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

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

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

    .content-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

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

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

    .table-container {
        font-size: 14px;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
    }

    .mobile-menu-toggle {
        display: block;
    }
}

/* Extra-small devices tweaks */
@media (max-width: 480px) {
    .content-title { font-size: 18px; }
    .card { padding: 16px; }
    .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .btn-group { width: 100%; }
    .btn-group .btn { width: 100%; }
    .table th, .table td { padding: 8px 10px; font-size: 12px; }
    .search-input { width: 100%; }
    .filter-select { width: 100%; }
    .tabs { padding: 6px 8px; gap: 6px; }
    .tabs .tab { padding: 6px 10px; font-size: 12px; }
    .badge, .badge-pill { font-size: 11px; }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--light-color);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Additional Admin Panel Styles */
.filter-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    width: 200px;
    min-width: 150px;
}

.filter-select {
    width: 120px;
    min-width: 100px;
}

.product-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

/* Modal JavaScript Support */
.modal.show {
    display: flex !important;
}

/* Responsive Filter Forms */
@media (max-width: 768px) {
    .filter-form {
        flex-direction: column;
        width: 100%;
    }
    
    .search-input,
    .filter-select {
        width: 100%;
    }
}
