/* ============================================================================
   DESIGN SYSTEM IMPORTS
   ============================================================================ */
@import url('/styles/design-tokens.css');
@import url('/styles/utilities.css');

/* ============================================================================
   GLOBAL VARIABLES (Legacy - will be migrated to design-tokens.css)
   ============================================================================ */
:root {
    /* Variables already moved to design-tokens.css */
}

/* Alpine.js Cloak */
[x-cloak] {
    display: none !important;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
    padding-top: 80px; /* Hauteur du .home-nav */
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    border: 1px solid transparent;
    font-size: 0.95rem;
    gap: 0.5rem;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

/* Variants */
.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--bg-btn-sec);
    color: var(--text-main);
    border-color: var(--btn-border-sec);
}

.btn-secondary:hover {
    background-color: var(--bg-secondary);
    border-color: var(--border-hover);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background-color: var(--primary-soft);
    color: var(--primary-color);
}

/* Sizes */
.btn-sm {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* Shapes */
.btn-rounded {
    border-radius: 50px;
}

/* Effects */
.btn-shadow {
    box-shadow: var(--shadow-brand);
}

.btn-shadow:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-brand-lg);
}

.btn-shadow-lg {
    box-shadow: var(--shadow-brand-lg);
}

.btn-shadow-lg:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-brand-lg);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

/* Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-input);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* === LAYOUTS === */

/* Auth Layout (Login/Register) */
.auth-layout {
    min-height: 59vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    position: relative;
    overflow: hidden;
    padding: 2rem;
    padding-top: 100px;
    /* Account for absolute header */
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

[data-theme="dark"] .auth-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    text-decoration: none;
}

.auth-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    width: 100%;
}

.auth-forgot-password {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.auth-forgot-password a {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 500;
}

.auth-forgot-password a:hover {
    text-decoration: underline;
}

.btn-full-width {
    width: 100%;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-footer a {
    color: var(--primary-color);
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.form-error {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: none;
}

.auth-status {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    min-height: 1.5em;
}

.auth-status.success {
    color: var(--success-color);
}

.auth-status.error {
    color: var(--error-color);
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    background-color: var(--bg-secondary);
}

/* Sidebar styles consolidated in /styles/sidebar.css */

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-bar {
    height: var(--header-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.breadcrumbs {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.page-content {
    padding: 0.5rem 2rem 2rem; /* Réduction du padding haut de 2rem à 0.5rem */
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Pulse animation for submit button ready state */
@keyframes readyPulse {
    0%, 100% {
        box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px -1px rgba(59, 130, 246, 0.6), 0 0 30px rgba(59, 130, 246, 0.3);
    }
}

.btn-ready-pulse {
    animation: readyPulse 2s ease-in-out infinite;
}

/* === SHARED COMPONENTS (Header/Footer) === */

/* Navigation Header */
.home-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    padding: 0 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 20;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    transition: backdrop-filter 0.3s ease, box-shadow 0.3s ease;
}

.home-nav .container {
    position: relative;
}

[data-theme="light"] .home-nav {
    --bg-home-nav: rgba(228, 229, 240, 0.8);
    background: var(--bg-home-nav);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .home-nav {
    /* background: transparent; */
    /* Let the dark bg show through */
    --bg-home-nav: rgba(18, 19, 40, 0.4);
    background: var(--bg-home-nav);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Sticky Header — Glass Transition on Scroll */
.home-nav--scrolled {
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

[data-theme="light"] .home-nav--scrolled {
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .home-nav--scrolled {
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.home-logo {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

.auth-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-shrink: 0;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    margin-right: 0.5rem;
}

.theme-toggle:hover {
    background-color: var(--bg-secondary);
    color: var(--text-main);
}

@media (max-width: 1099px) {
    .home-nav {
        padding: 0 1rem;
    }
}

@media (max-width: 640px) {
    body {
        padding-top: 80px;
    }

    .home-nav {
        height: 80px;
        padding: 0 0.75rem;
    }
}

/* Footer Styles */
.footer-light {
    background: var(--bg-secondary);
    padding: 2rem 0 1rem;
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s, border-color 0.3s;
}

/* Améliorer le contraste du pied de page en mode light */
[data-theme="light"] .footer-light {
    --footer-bg-light: rgba(228, 229, 240, 0.8);
    background: var(--footer-bg-light);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .footer-light {
    --footer-bg-dark: rgba(18, 19, 40, 0.4);
    background: var(--footer-bg-dark);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(59, 130, 246, 0.1);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    margin-bottom: 1rem;
}

.footer-col h4 {
    color: var(--text-main);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    transition: color 0.3s;
}

.footer-col a {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    transition: color 0.2s;
    font-size: 0.95rem;
}

.footer-col a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    padding: 2rem 2rem 0;
    align-items: center;
}
