/* ============================================
   PhotoManager Pro — CSS Principal
   Dark theme par défaut
   ============================================ */

/* --- Variables CSS --- */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1f2937;
    --bg-input: #374151;
    --bg-hover: #2d3748;
    --text-primary: #e0e0e0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #e94560;
    --accent-hover: #c73e54;
    --accent-light: rgba(233, 69, 96, 0.15);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --border: #374151;
    --shadow: rgba(0, 0, 0, 0.3);
    --radius: 8px;
    --radius-sm: 4px;
    --sidebar-width: 240px;
    --navbar-height: 56px;
    --transition: 0.2s ease;
}

[data-theme="light"] {
    --bg-primary: #f3f4f6;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f9fafb;
    --bg-hover: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border: #d1d5db;
    --shadow: rgba(0, 0, 0, 0.1);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.navbar-logo:hover { color: var(--accent); }

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-user {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- Layout principal --- */
.app-layout {
    display: flex;
    padding-top: var(--navbar-height);
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 900;
    transition: transform var(--transition);
}

.sidebar-nav {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition);
}
.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.sidebar-link.active {
    color: var(--accent);
    background: var(--accent-light);
    border-right: 3px solid var(--accent);
}

.sidebar-icon { font-size: 1.1rem; width: 24px; text-align: center; }

.sidebar-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 8px 16px;
}

/* --- Contenu principal --- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 24px;
    min-width: 0;
}

/* --- Boutons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

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

.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* --- Formulaires --- */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 4px;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

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

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

/* --- Toast notifications --- */
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    animation: toastIn 0.3s ease;
}

.toast-success { background: rgba(16, 185, 129, 0.15); border-left: 4px solid var(--success); color: var(--success); }
.toast-error { background: rgba(239, 68, 68, 0.15); border-left: 4px solid var(--danger); color: var(--danger); }
.toast-info { background: rgba(59, 130, 246, 0.15); border-left: 4px solid var(--info); color: var(--info); }
.toast-warning { background: rgba(245, 158, 11, 0.15); border-left: 4px solid var(--warning); color: var(--warning); }

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

/* --- Page Auth (login/register) --- */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Grille utilitaire --- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .navbar-toggle { display: block; }

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

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

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .auth-card { padding: 24px; }
}

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* --- Layout public (galeries) --- */
.layout-public {
    min-height: 100vh;
}

.layout-public:has(.auth-container) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.public-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.public-content--fullwidth {
    max-width: none;
    padding: 0;
}

.layout-public:has(.showcase-page) {
    display: block;
}

.layout-public:has(.showcase-page) .public-content {
    max-width: none;
    padding: 0;
}

/* --- Showcase page (style SmugMug) --- */
.showcase-page {
    background: var(--bg-primary);
}

/* Navigation bar */
.showcase-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

.showcase-nav-left { display: flex; align-items: center; }
.showcase-nav-right { display: flex; align-items: center; gap: 8px; }

.showcase-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.showcase-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.showcase-input {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 5px 10px;
    font-size: 0.8rem;
    width: 140px;
    outline: none;
    transition: border-color var(--transition);
}
.showcase-input:focus { border-color: var(--accent); }
.showcase-input::placeholder { color: rgba(255, 255, 255, 0.4); }

.showcase-error {
    color: var(--danger);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Hero banner */
.showcase-hero {
    position: relative;
    width: 100vw;
    height: 70vh;
    min-height: 400px;
    overflow: hidden;
    margin-top: 48px;
}

.showcase-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.showcase-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 40px 30px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
}

.showcase-hero-title {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.showcase-hero-subtitle {
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 300;
}

/* Albums grid */
.showcase-albums {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 20px 4px 4px;
}

.showcase-album-card {
    position: relative;
    flex: 1 1 280px;
    height: 200px;
    overflow: hidden;
    cursor: default;
}

.showcase-album-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.showcase-album-card:hover img {
    transform: scale(1.05);
}

.showcase-album-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    color: #fff;
}

.showcase-album-name {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Albums without cover */
.showcase-albums-text {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px;
}

.showcase-album-text-item {
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Photo strip */
.showcase-strip {
    display: flex;
    gap: 4px;
    padding: 4px;
    height: 200px;
}

.showcase-strip-cell {
    overflow: hidden;
    min-width: 0;
    height: 100%;
}

.showcase-strip-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.showcase-strip-cell:hover img {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .showcase-nav {
        padding: 0 10px;
        height: 44px;
    }
    .showcase-form { flex-wrap: wrap; }
    .showcase-input { width: 100px; font-size: 0.75rem; }
    .showcase-hero { height: 50vh; min-height: 280px; margin-top: 44px; }
    .showcase-hero-title { font-size: 1.6rem; }
    .showcase-album-card { height: 150px; }
    .showcase-strip { height: 120px; }
}

@media (max-width: 480px) {
    .showcase-nav-left { display: none; }
}
