/* =================
   VARIABLES & RESET
   ================= */

:root {
    --primary-color: #0078d4;
    --secondary-color: #107c10;
    --accent-color: #ff8c00;
    --dark-bg: #1e1e1e;
    --light-bg: #f5f5f5;
    --text-dark: #333333;
    --text-light: #ffffff;
    --border-color: #e0e0e0;
    --error-color: #d13438;
    --success-color: #107c10;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--light-bg);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-color);
}

/* =================
   HEADER/NAVIGATION
   ================= */

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #005a9e 100%);
    color: var(--text-light);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.logo::before {
    content: '⚡';
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--text-light);
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.nav-links a:hover {
    opacity: 0.8;
    color: var(--text-light);
}

.user-info {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-left: auto;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: var(--text-light);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-decoration: none;
    font-weight: 500;
}

.btn:hover {
    background-color: #005a9e;
    box-shadow: var(--shadow);
    color: var(--text-light);
}

.btn-secondary {
    background-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #0a6a0a;
}

.btn-danger {
    background-color: var(--error-color);
}

.btn-danger:hover {
    background-color: #a91f28;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* =================
   CONTAINER & LAYOUT
   ================= */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

main {
    min-height: calc(100vh - 200px);
}

/* =================
   HERO SECTION
   ================= */

.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-light);
    padding: 4rem 2rem;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-lg);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* =================
   FORMS
   ================= */

.form-container {
    background: var(--text-light);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 400px;
    margin: 2rem auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

textarea {
    resize: vertical;
    min-height: 200px;
    font-family: 'Courier New', monospace;
}

/* =================
   ALERTS
   ================= */

.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.alert::before {
    content: '⚠️';
    font-size: 1.2rem;
    flex-shrink: 0;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-success::before {
    content: '✓';
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-info::before {
    content: 'ℹ';
}

/* =================
   STYLES POUR CARTES/CARDS
   ================= */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--text-light);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #005a9e 100%);
    color: var(--text-light);
    padding: 1.5rem;
}

.card-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background-color: var(--light-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.category-badge {
    display: inline-block;
    background-color: var(--secondary-color);
    color: var(--text-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* =================
   CODE BLOCK
   ================= */

.code-block {
    background-color: var(--dark-bg);
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1rem 0;
    position: relative;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #444;
}

.copy-btn {
    background-color: var(--primary-color);
    color: var(--text-light);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.3s ease;
}

.copy-btn:hover {
    background-color: #005a9e;
}

.copy-btn.copied {
    background-color: var(--success-color);
}

code {
    background-color: #f0f0f0;
    padding: 0.2rem 0.4rem;
    border-radius: 2px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.code-block code {
    background-color: transparent;
    padding: 0;
}

/* =================
   FOOTER
   ================= */

footer {
    background-color: var(--dark-bg);
    color: var(--text-light);
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

footer p {
    margin: 0.5rem 0;
}

/* =================
   UTILITIES
   ================= */

.text-center {
    text-align: center;
}

.text-muted {
    color: #666;
}

.mt {
    margin-top: 2rem;
}

.mb {
    margin-bottom: 2rem;
}

.hidden {
    display: none;
}

/* =================
   RESPONSIVE - TABLET
   ================= */

@media (max-width: 1024px) {
    .container {
        padding: 1.5rem;
    }

    nav {
        padding: 0 1.5rem;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .hero {
        padding: 3rem 1.5rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .nav-links {
        gap: 1.5rem;
    }
}

/* =================
   RESPONSIVE - MOBILE
   ================= */

@media (max-width: 768px) {
    /* Typography */
    html {
        font-size: 15px;
    }

    .hero h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .hero h2 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    /* Navigation */
    nav {
        padding: 0 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
        width: 100%;
        flex-direction: column;
        align-items: center;
    }

    .nav-links a {
        padding: 0.5rem 0;
    }

    .logo {
        width: 100%;
        justify-content: center;
        font-size: 1.3rem;
    }

    .user-info {
        width: 100%;
        margin-left: 0;
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Hero Section */
    .hero {
        padding: 2.5rem 1rem;
        margin-bottom: 2rem;
        border-radius: 0;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    /* Layout */
    .container {
        padding: 1rem;
    }

    main {
        min-height: calc(100vh - 150px);
    }

    /* Grid */
    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Cards */
    .card {
        border-radius: 4px;
    }

    .card-header {
        padding: 1rem;
    }

    .card-header h2 {
        font-size: 1.1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
    }

    .card-footer .btn {
        width: 100%;
        text-align: center;
    }

    /* Forms */
    .form-container {
        padding: 1.5rem;
        max-width: 100%;
        margin: 1rem auto;
        border-radius: 4px;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    label {
        font-size: 0.95rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        padding: 0.65rem;
        font-size: 16px;
    }

    /* Buttons */
    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.95rem;
        border-radius: 4px;
        width: auto;
    }

    .btn-small {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Code Block */
    .code-block {
        padding: 1rem;
        font-size: 0.8rem;
        margin: 1rem -1rem;
        border-radius: 0;
    }

    .code-block-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
        margin-bottom: 0.75rem;
    }

    .copy-btn {
        width: 100%;
    }

    /* Footer */
    footer {
        padding: 1.5rem 1rem;
        margin-top: 2rem;
    }

    /* Utilities */
    .hidden-mobile {
        display: none;
    }
}

/* =================
   RESPONSIVE - SMALL MOBILE
   ================= */

@media (max-width: 480px) {
    /* Typography */
    html {
        font-size: 14px;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero h2 {
        font-size: 1.2rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .card-header h2 {
        font-size: 1rem;
    }

    /* Navigation */
    nav {
        padding: 0 0.75rem;
    }

    .logo {
        font-size: 1rem;
    }

    .logo::before {
        font-size: 1.3rem;
    }

    .nav-links {
        gap: 0.75rem;
    }

    /* Hero Section */
    .hero {
        padding: 2rem 0.75rem;
    }

    .hero-buttons .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    /* Layout */
    .container {
        padding: 0.75rem;
    }

    /* Forms */
    .form-container {
        padding: 1rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        padding: 0.6rem;
        font-size: 16px;
    }

    textarea {
        min-height: 120px;
    }

    /* Alerts */
    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Code Block */
    .code-block {
        padding: 0.75rem;
        font-size: 0.75rem;
        margin: 0.75rem -0.75rem;
    }

    /* Category Badge */
    .category-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }

    /* Buttons */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    /* Footer */
    footer {
        padding: 1rem 0.75rem;
    }

    footer p {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }

    .card-header h2 {
        font-size: 1.1rem;
    }

    .form-container {
        padding: 1rem;
        max-width: 100%;
    }
}

/* =================
   COOKIE BANNER
   ================= */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--dark-bg);
    color: var(--text-light);
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none; /* Masqué par défaut, affiché par JS si pas de consentement */
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.cookie-content p {
    margin: 0;
    flex: 1;
}

.cookie-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    padding: 0.5rem;
}

.btn-link:hover {
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }

    .cookie-buttons {
        flex-direction: column;
        width: 100%;
    }

    .cookie-buttons .btn {
        width: 100%;
    }
}
