/* Design System & Variables (Style Apple) */
:root {
    --bg-color: #000000;
    --surface-color: #0b0b0c;
    --surface-card: #0e0e10;
    --border-color: #1d1d1f;
    --text-primary: #ffffff;
    --text-secondary: #86868b;
    --text-muted: #515154;
    --accent-color: #ffffff;
    --danger-color: #ff3b30;
    --danger-hover: #ff453a;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    --transition-smooth: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: #2c2c2e;
    border-radius: 3px;
}

/* En-tête */
.admin-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    z-index: 100;
}

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

.admin-logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-main {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.15em;
}

.logo-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background-color: var(--text-muted);
    color: var(--bg-color);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.back-link:hover {
    color: var(--text-primary);
}

/* Conteneur principal */
.admin-main {
    padding: 4rem 0;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

/* Sections */
.admin-section {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

/* Drag & Drop */
.drop-zone {
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.03);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    pointer-events: none;
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    transition: var(--transition-fast);
}

.drop-zone:hover .upload-icon {
    color: var(--text-primary);
}

.drop-zone-text {
    font-size: 0.95rem;
    font-weight: 500;
}

.drop-zone-or {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* File Preview Block */
.file-preview-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.8rem 1.2rem;
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

.file-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-fast);
}

.btn-clear:hover {
    color: var(--danger-color);
}

/* Form Controls */
.form-controls {
    display: flex;
    align-items: flex-end;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

/* Custom Select Dropdown */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper select {
    width: 100%;
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.9rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    appearance: none;
    outline: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.select-wrapper select:focus {
    border-color: var(--text-secondary);
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-secondary);
    pointer-events: none;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.9rem 2.2rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: #e5e5ea;
}

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

.btn-secondary-small {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* Category Tabs */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.section-header .section-title {
    margin-bottom: 0;
}

.category-tabs {
    display: flex;
    gap: 0.5rem;
    background-color: var(--surface-card);
    padding: 0.3rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.tab-btn.active {
    background-color: var(--surface-color);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* Grid & Cards */
.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-gap: 2rem;
}

.admin-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}

.admin-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.admin-card:hover img {
    transform: scale(1.03);
}

/* Delete Overlay */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: var(--transition-fast);
    pointer-events: none;
}

.admin-card:hover .card-overlay {
    opacity: 1;
    pointer-events: auto;
}

.btn-delete {
    background-color: var(--danger-color);
    color: var(--text-primary);
    border: none;
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition-fast);
    transform: translateY(10px);
}

.admin-card:hover .btn-delete {
    transform: translateY(0);
}

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

/* Overlay de Synchronisation */
.sync-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(15px);
    z-index: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sync-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sync-modal {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
    animation: scaleUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    margin: 0 auto 1.5rem auto;
    animation: spin 0.8s linear infinite;
}

.sync-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.sync-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Notification Toasts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    z-index: 1000;
}

.toast {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success {
    border-left: 3px solid #34c759;
}

.toast.error {
    border-left: 3px solid var(--danger-color);
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .admin-container {
        padding: 0 1rem;
    }
    .admin-section {
        padding: 1.5rem;
    }
    .form-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1.2rem;
    }
    .btn-submit {
        width: 100%;
    }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .category-tabs {
        width: 100%;
        overflow-x: auto;
    }
}

.btn-danger-small {
    background-color: var(--danger-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

/* Checkbox Styles for Mass Selection */
.admin-card .checkbox-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    background-color: rgba(0, 0, 0, 0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: var(--transition-fast);
}

.admin-card .checkbox-indicator::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--bg-color);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(0, -1px);
    opacity: 0;
    transition: var(--transition-fast);
}

/* Selection Mode Active State */
.manager-section.select-mode .checkbox-indicator {
    display: flex;
}

.admin-card.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--text-primary);
}

.admin-card.selected .checkbox-indicator {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
}

.admin-card.selected .checkbox-indicator::after {
    opacity: 1;
}

/* Hide normal hover overlays in select mode */
.manager-section.select-mode .admin-card:hover .card-overlay {
    opacity: 0;
    pointer-events: none;
}

/* Portfolio Rows Management */
.portfolio-row {
    display: grid;
    grid-template-columns: 110px 150px 1fr 1.2fr 135px 160px auto;
    gap: 1rem;
    align-items: flex-end;
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 8px;
    position: relative;
    transition: var(--transition-fast);
}

.portfolio-row .form-group {
    min-width: 0;
}

.cover-preview {
    width: 160px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #000;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    position: relative;
}

.cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
}

.portfolio-row:hover {
    border-color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.02);
}

.portfolio-row .btn-delete-row {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    height: 38px;
    width: 38px;
    margin-bottom: 2px;
}

.portfolio-row .btn-delete-row:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background-color: rgba(255, 59, 48, 0.1);
}

.portfolio-input {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    width: 100%;
    transition: var(--transition-fast);
    font-family: var(--font-family);
}

.portfolio-input:focus {
    border-color: var(--text-secondary);
}

.portfolio-input:disabled {
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    border-color: var(--border-color);
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .portfolio-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .portfolio-row .btn-delete-row {
        width: 100%;
        height: auto;
        padding: 0.8rem;
    }
}

/* Hero Slideshow Manager */
.hero-slide-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}

.hero-slide-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-slide-card .btn-delete-slide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background-color: var(--danger-color);
    color: var(--text-primary);
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition-fast);
    pointer-events: none;
    z-index: 5;
}

.hero-slide-card:hover .btn-delete-slide {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.hero-slide-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: var(--transition-fast);
}

.hero-slide-card:hover::after {
    opacity: 1;
}

/* ==========================================
   ADMIN LOGIN OVERLAY
   ========================================== */
.admin-login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s;
}

.admin-login-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.admin-login-card {
    text-align: center;
    max-width: 380px;
    width: 90%;
}

.admin-login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.admin-login-logo .logo-img {
    height: 48px;
    width: auto;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-login-card:hover .logo-img {
    transform: scale(1.03);
}

.admin-logo .logo-img {
    height: 24px;
    width: auto;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-logo:hover .logo-img {
    transform: scale(1.03);
}

.admin-login-badge {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

#admin-login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#admin-password-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 1rem 0;
    font-size: 1rem;
    font-family: var(--font-family);
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
    letter-spacing: 0.3em;
}

#admin-password-input:focus {
    border-bottom-color: var(--text-primary);
}

#admin-password-input::placeholder {
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.admin-login-error {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 1rem;
    animation: shakeX 0.5s;
}

@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

/* ==========================================
   CLIENT MANAGEMENT SECTION
   ========================================== */
.client-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition-fast);
}

.client-card:hover {
    border-color: rgba(255,255,255,0.1);
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.client-card-title {
    font-size: 1rem;
    font-weight: 600;
}

.client-card-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    letter-spacing: 0.1em;
    background: rgba(255,255,255,0.04);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
}

.client-card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.client-card-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.client-photo-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
}

.client-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.client-photo-thumb:hover img {
    transform: scale(1.05);
}

.client-photo-thumb .photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 59, 48, 0.85);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.client-photo-thumb:hover .photo-remove {
    opacity: 1;
}

.client-upload-zone {
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 1rem;
    transition: var(--transition-fast);
    cursor: pointer;
}

.client-upload-zone:hover {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.client-photo-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.client-url-copy {
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.client-url-copy:hover {
    color: var(--text-primary);
}

.clients-section .btn-danger-small {
    background: transparent;
    color: var(--danger-color);
    border: 1px solid rgba(255, 59, 48, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: var(--font-family);
}

.clients-section .btn-danger-small:hover {
    background: rgba(255, 59, 48, 0.1);
    border-color: var(--danger-color);
}

