:root {
    --bg-color: #0f172a; /* Slate 900 */
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #94a3b8; /* Slate 400 */
    --accent: #3b82f6; /* Blue 500 */
    --accent-hover: #2563eb; /* Blue 600 */
    --card-bg: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity */
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    background-image: radial-gradient(circle at 50% -20%, #1e293b, #0f172a 80%);
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.glass-header {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 20px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.accent {
    color: var(--accent);
}

.brand-nav {
    display: flex;
    gap: 15px;
}

.brand-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.brand-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.brand-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 80px 20px 40px;
    animation: fadeIn 0.8s ease forwards;
}

.hero h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Filters */
.filters-section {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    transition: opacity 0.4s ease;
}

.filters-section.hidden {
    opacity: 0;
    pointer-events: none;
    height: 0;
    margin: 0;
    overflow: hidden;
}

.filters-container {
    background: var(--card-bg);
    padding: 6px;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    display: flex;
    gap: 10px;
}

.filter-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--text-primary);
    color: var(--bg-color);
}

/* Catalog Grid */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding-bottom: 60px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.6s ease forwards;
    opacity: 0;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    border-color: rgba(255,255,255,0.2);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

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

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

.card-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.card-badge.extérieur {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.card-category {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 10px;
    font-weight: 500;
}

.card-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    flex-grow: 1;
}

footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--glass-border);
    margin-top: 40px;
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    .hero h2 {
        font-size: 2.2rem;
    }
}

/* =========================================
   Editor Mode Styles
   ========================================= */

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.editor-toggle {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.editor-toggle:hover {
    opacity: 1;
}

.editor-toggle.active {
    opacity: 1;
    filter: drop-shadow(0 0 5px var(--accent));
}

.editor-actions {
    display: flex;
    gap: 10px;
    margin-left: 20px;
}

.editor-actions.hidden {
    display: none;
}

.action-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-main);
}

.save-btn {
    background-color: #10b981;
    color: white;
}
.save-btn:hover {
    background-color: #059669;
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-color);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 10px;
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin: 15px 0;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
    font-family: var(--font-main);
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.cancel-btn, .submit-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.cancel-btn {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

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

.error-msg {
    color: #ef4444;
    margin-top: 10px;
    font-size: 0.9rem;
}
.error-msg.hidden {
    display: none;
}

/* Editor Inputs inside Cards */
.edit-input {
    width: 100%;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 4px;
    font-family: var(--font-main);
    margin-bottom: 5px;
}
.edit-textarea {
    width: 100%;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 4px;
    font-family: var(--font-main);
    min-height: 60px;
    resize: vertical;
}

/* Thumbnails Editor */
.thumbnails-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    margin-bottom: 10px;
    scrollbar-width: thin;
}
.thumb-item {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
}
.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumb-actions {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: space-between;
    padding: 2px 5px;
}
.thumb-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 12px;
}
.thumb-btn:hover {
    color: var(--accent);
}
.delete-thumb {
    position: absolute;
    top: 2px; right: 2px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px; height: 20px;
    cursor: pointer;
    font-size: 10px;
    display: flex; align-items: center; justify-content: center;
}
.add-image-btn {
    width: 80px; height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 2px dashed var(--glass-border);
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.add-image-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Lightbox */
.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
}
.lightbox-img-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.lightbox-img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.lightbox-btn {
    position: absolute;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
    z-index: 1001;
}
.lightbox-btn:hover {
    background: var(--accent);
}
.close-btn {
    top: -20px;
    right: -20px;
    width: 40px;
    height: 40px;
}
.nav-btn {
    top: 50%;
    transform: translateY(-50%);
}
.prev-btn {
    left: -20px;
}
.next-btn {
    right: -20px;
}
/* Allow clicking image to open lightbox */
.view-mode-image {
    cursor: zoom-in;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    .brand-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .brand-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    .hero h2 {
        font-size: 2rem;
    }
    .hero p {
        font-size: 1rem;
    }
    .hero {
        padding: 40px 10px 20px;
    }
    .filters-container {
        flex-wrap: wrap;
        justify-content: center;
    }
    .filter-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    .catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 15px;
    }
    .lightbox-content {
        width: 100%;
        height: 90vh;
    }
    .lightbox-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .close-btn {
        top: 10px;
        right: 10px;
    }
    .prev-btn {
        left: 10px;
    }
    .next-btn {
        right: 10px;
    }
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    #editor-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .save-btn, .export-btn {
        width: 100%;
        text-align: center;
    }
}
