/* Toile Admin Dashboard - Premium CSS */

/* ===== CSS Variables (Toile Color Scheme) ===== */
:root {
    --primary: #1a3e2a;
    /* Deep forest green */
    --primary-dark: #0f251a;
    --primary-light: #2a5a3d;
    --secondary: #8b4557;
    /* Rich burgundy */
    --accent: #d4a574;
    /* Warm gold */
    --background: #faf8f5;
    /* Cream white */
    --surface: #ffffff;
    --text: #2c2c2c;
    /* Dark charcoal */
    --text-light: #6b6b6b;
    --border: #e0ddd8;
    --success: #2e7d32;
    --error: #c62828;
    --warning: #f57c00;
    --info: #1976d2;

    --sidebar-width: 280px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

/* ===== App Container ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 6px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.6;
    margin-top: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    border-left: 4px solid transparent;
    margin: 0.25rem 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: var(--accent);
}

.nav-icon {
    margin-right: 1rem;
    font-size: 1.25rem;
    width: 28px;
    text-align: center;
}

.nav-section {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.5rem;
}

.sidebar-footer {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-info::before {
    content: "👤";
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: var(--transition);
}

.logout-btn:hover {
    background: var(--secondary);
    border-color: var(--secondary);
    transform: translateY(-2px);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--background) 0%, #f0ede8 100%);
}

/* ===== Flash Messages ===== */
.flash-message {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flash-success {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.flash-error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: var(--error);
    border-left: 4px solid var(--error);
}

.flash-warning {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}

.flash-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: var(--info);
    border-left: 4px solid var(--info);
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 2.5rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.page-header p {
    color: var(--text-light);
    margin-top: 0.5rem;
    font-size: 1.0625rem;
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: var(--transition);
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid var(--border);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 4px solid var(--primary);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: block;
    text-decoration: none;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 62, 42, 0.02) 0%, transparent 100%);
}

.stat-card-link {
    cursor: pointer;
}

.stat-card-link:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-top-color: var(--accent);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.stat-link-hint {
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: var(--primary);
    opacity: 0;
    transition: var(--transition);
}

.stat-card-link:hover .stat-link-hint {
    opacity: 1;
}

/* ===== Feature Cards ===== */
.feature-card {
    display: block;
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.feature-card-primary {
    background: linear-gradient(135deg, rgba(26, 62, 42, 0.08) 0%, rgba(26, 62, 42, 0.02) 100%);
    border-left: 4px solid var(--primary);
}

.feature-card-secondary {
    background: linear-gradient(135deg, rgba(139, 69, 87, 0.08) 0%, rgba(139, 69, 87, 0.02) 100%);
    border-left: 4px solid var(--secondary);
}

.feature-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.feature-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

.feature-card-primary h3 {
    color: var(--primary);
}

.feature-card-secondary h3 {
    color: var(--secondary);
}

.feature-card p {
    color: var(--text-light);
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.feature-link {
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0;
    transition: var(--transition);
}

.feature-card-primary .feature-link {
    color: var(--primary);
}

.feature-card-secondary .feature-link {
    color: var(--secondary);
}

.feature-card:hover .feature-link {
    opacity: 1;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.625rem;
    color: var(--text);
    font-size: 0.9375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--surface);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 62, 42, 0.1);
}

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

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(26, 62, 42, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 62, 42, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #6d3645 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 69, 87, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 69, 87, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-lg {
    padding: 1.125rem 2.5rem;
    font-size: 1.125rem;
}

.btn-icon {
    font-size: 1.125rem;
}

/* ===== File Upload ===== */
.file-upload {
    display: block;
    border: 3px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: linear-gradient(135deg, rgba(26, 62, 42, 0.02) 0%, rgba(26, 62, 42, 0.01) 100%);
    width: 100%;
    box-sizing: border-box;
}

.file-upload:hover {
    border-color: var(--primary);
    background: rgba(26, 62, 42, 0.04);
}

.file-upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.file-upload-text {
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.file-upload-text strong {
    color: var(--primary);
}

.file-upload input[type="file"] {
    display: none;
}

/* ===== Tables ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

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

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

.table th {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    font-size: 0.8125rem;
    letter-spacing: 0.5px;
}

.table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

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

.table tbody tr:hover {
    background: rgba(26, 62, 42, 0.04);
}

/* ===== Product Grid ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.product-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--border) 0%, #e8e5e0 100%);
}

.product-info {
    padding: 1.25rem;
}

.product-name {
    font-weight: 600;
    margin-bottom: 0.375rem;
    font-size: 1rem;
}

.product-price {
    color: var(--secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

/* ===== Image Gallery ===== */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    border: 3px solid transparent;
}

.image-item:hover {
    transform: scale(1.05);
}

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

.image-item.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 62, 42, 0.2);
}

.image-item .checkbox {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border);
}

.image-item.selected .checkbox {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== Progress Bar ===== */
.progress-bar {
    background: var(--border);
    border-radius: 100px;
    height: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 100px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* ===== Login Page ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    position: relative;
}

.login-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/static/images/showroom.jpg') center/cover;
    opacity: 0.15;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 8px;
    text-transform: uppercase;
}

.login-header p {
    color: var(--text-light);
    margin-top: 0.75rem;
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* ===== Loading States ===== */
.loading-spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== Quick Actions ===== */
.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

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

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

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

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

    .login-card {
        margin: 1rem;
        padding: 2rem;
    }
}