:root {
    --primary: #6366f1;
    --accent: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-app: #f1f5f9;
    --bg-dark: #0f172a;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --sidebar-w: 280px;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.03), 0 10px 40px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
}

/* Centered Body for Auth Pages */
body.centered-body {
    min-height: 100vh;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

/* Glassy Sidebar */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: white;
    position: fixed;
    left: 0;
    top: 0;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0,0,0,0.05);
    z-index: 100;
}

.sidebar-brand {
    padding: 0 1rem;
    margin-bottom: 4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
    color: var(--primary);
    background: #f8fafc;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

/* Main Content Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-w);
    padding: 3rem 4rem;
    min-height: 100vh;
}

/* Modern Headers */
h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

/* Futuristic Inputs */
.input-group {
    display: flex;
    background: white;
    padding: 0.6rem;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    gap: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(0,0,0,0.03);
    transition: focus-within 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

input[type="text"] {
    flex: 1;
    border: none;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    outline: none;
    background: transparent;
    font-family: inherit;
    color: var(--text-main);
}

/* Buttons */
button {
    background: #0f172a;
    color: white;
    border: none;
    padding: 0.85rem 2.5rem;
    border-radius: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
}

button:hover {
    background: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
}

button[type="submit"] {
    background: #0f172a;
    color: white;
    border: none;
    padding: 0.85rem 2.5rem;
    border-radius: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

button[type="submit"]:hover {
    background: #1e293b;
    transform: translateY(-2px);
}

button[type="submit"]:active {
    transform: translateY(0);
}

#status-text {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Results Grid */
.results {
    margin-top: 3rem;
    display: none;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.image-card {
    background: #f8fafc;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
    cursor: pointer;
    position: relative;
}

.image-card:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.image-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #e2e8f0;
}

.image-info {
    padding: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease forwards;
}

/* Auth Pages spécifique */
.auth-container {
    width: 100%;
    max-width: 450px;
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Progress Container */
.progress-container {
    display: none;
    text-align: center;
    margin: 3rem 0;
    padding: 2rem;
    background: white;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Results Container */
.results {
    margin-top: 3rem;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem 1.5rem 2rem;
}

/* Shared Tool Layout */
.tool-page {
    max-width: 1520px;
    width: 100%;
    margin: 0 auto;
}

.tool-hero-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 58%, #0ea5e9 145%);
    border-radius: 28px;
    padding: 2.25rem;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
    margin-bottom: 1.75rem;
}

.tool-hero-card::after {
    content: '';
    position: absolute;
    right: -60px;
    bottom: -60px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(255,255,255,0.16), transparent 65%);
    pointer-events: none;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.16);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.tool-hero-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 1.25rem;
    align-items: center;
}

.tool-hero-card h1 {
    color: white;
    margin-bottom: 0.65rem;
}

.tool-hero-card .subtitle {
    color: rgba(255,255,255,0.8);
    margin-bottom: 1rem;
    max-width: 780px;
}

.tool-feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.tool-feature-item {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.12);
    color: white;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    font-size: 0.84rem;
    font-weight: 600;
}

.tool-hero-stats {
    display: grid;
    gap: 0.75rem;
}

.hero-stat {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    padding: 0.95rem 1rem;
}

.hero-stat strong {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.hero-stat span {
    color: rgba(255,255,255,0.78);
    font-size: 0.82rem;
}

.tool-layout {
    display: grid;
    grid-template-columns: 410px minmax(0, 1fr);
    gap: 1.75rem;
    align-items: start;
}

.tool-panel,
.tool-results-card {
    background: white;
    border-radius: 24px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: var(--card-shadow);
}

.tool-panel {
    padding: 1.6rem;
    position: sticky;
    top: 1.5rem;
}

.tool-results-card {
    padding: 1.6rem;
}

.tool-panel-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.tool-panel-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.tool-info-box {
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 18px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.tool-empty {
    display: none;
}

.tool-empty svg {
    display: none;
}

.tool-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tool-toolbar h3 {
    margin: 0 0 0.25rem 0;
}

.tool-toolbar p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tool-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.tool-kpi {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e5edf7;
    border-radius: 18px;
    padding: 1rem;
}

.tool-kpi-value {
    font-size: 1.9rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.tool-kpi-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.tool-scroll {
    max-height: 75vh;
    overflow-y: auto;
    padding-right: 0.35rem;
}

@media (max-width: 1100px) {
    .tool-hero-grid,
    .tool-layout {
        grid-template-columns: 1fr;
    }

    .tool-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .tool-hero-card,
    .tool-panel,
    .tool-results-card {
        padding: 1rem;
    }
}

/* Media Cards */
.media-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.media-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}
