/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

:root {
    /* Thème Clair (Défaut) */
    --bg-color: #ffffff;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --search-bg: #ffffff;
    --search-border: #dfe1e5;
    --search-shadow: rgba(32, 33, 36, 0.28);
    --icon-bg: #f1f3f4;
    --icon-hover: #e8eaed;
    --glass-bg: transparent;
    --glass-border: transparent;
    --body-bg: var(--bg-color);
    --sky-blue: #1a73e8;
    --error-red: #d93025;
}

body.theme-dark {
    /* Thème Foncé */
    --bg-color: #202124;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --search-bg: #303134;
    --search-border: #5f6368;
    --search-shadow: rgba(23, 23, 23, 0.8);
    --icon-bg: #303134;
    --icon-hover: #3c4043;
    --body-bg: var(--bg-color);
    --sky-blue: #8ab4f8;
}

body.theme-img {
    /* Thème Image (Ancien Login) - Injection : Texte en noir & Contraste ajusté */
    --text-primary: #000000;
    --text-secondary: rgba(0, 0, 0, 0.7);
    --search-bg: rgba(255, 255, 255, 0.25);
    --search-border: rgba(0, 0, 0, 0.2);
    --search-shadow: rgba(0, 0, 0, 0.3);
    --icon-bg: rgba(0, 0, 0, 0.05);
    --icon-hover: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(0, 0, 0, 0.1);
    --sky-blue: #1a73e8;
    --body-bg: #f0f0f0 url('Bckg-ia6-1.png') no-repeat center center/cover fixed;
}

/* Injection : Amélioration du scroll tactile */
html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    min-height: 100vh;
    /* Injection : Largeur minimale pour éviter les cassures sur très petits écrans */
    min-width: 320px; 
    display: flex;
    flex-direction: column;
    background: var(--body-bg);
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

/* === HEADER INVISIBLE === */
.top-header {
    position: absolute;
    top: 0; right: 0;
    width: 100%;
    padding: 15px 25px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    z-index: 100;
}

.control-select {
    background: var(--search-bg);
    color: var(--text-primary);
    border: 1px solid var(--search-border);
    border-radius: 20px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.control-select:hover { border-color: var(--text-secondary); }

/* Bouton 9 Carrés (CSS pur) */
.apps-grid {
    width: 32px; height: 32px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}
.apps-grid:hover { background: var(--icon-hover); }
.apps-grid span { background: var(--text-secondary); border-radius: 50%; }

/* Logo Circulaire */
.profile-logo {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--search-border);
}

/* === MAIN INDEX (Google Clone) === */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.logo-container { text-align: center; margin-bottom: 25px; }
.logo-container h1 { font-size: 4rem; margin: 0; font-weight: 700; letter-spacing: -2px; }
.logo-container img { max-height: 90px; object-fit: contain; }
.slogan-text { font-size: 0.9rem; color: var(--text-secondary); margin-top: 5px; }

/* Search Box */
.search-box {
    width: 100%;
    display: flex;
    align-items: center;
    background: var(--search-bg);
    border: 1px solid var(--search-border);
    border-radius: 24px;
    padding: 10px 20px;
    transition: box-shadow 0.2s;
}
.search-box:hover, .search-box:focus-within { box-shadow: 0 1px 6px var(--search-shadow); }

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 10px;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
}
.search-box input::placeholder { color: var(--text-secondary); }

.powered-by {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 10px;
    text-align: center;
}

/* Shortcuts */
.shortcuts-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 30px;
    max-width: 500px;
}
.shortcut-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary);
    width: 80px;
    transition: transform 0.2s;
}
.shortcut-item:hover { transform: translateY(-2px); }
.shortcut-icon {
    width: 48px; height: 48px;
    background: var(--icon-bg);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
}
.shortcut-text { font-size: 0.75rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }

/* === LOGIN COMPONENT === */
.phone-frame {
    width: 92%; max-width: 380px;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 45px;
    padding: 50px 30px 30px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.6);
    text-align: center;
}
body:not(.theme-img) .phone-frame {
    background: var(--search-bg);
    border: 1px solid var(--search-border);
    box-shadow: 0 10px 30px var(--search-shadow);
}

.form-group { margin-bottom: 15px; }
.form-group input {
    width: 100%; padding: 16px;
    background: var(--icon-bg);
    border: 1px solid var(--search-border);
    border-radius: 14px;
    color: var(--text-primary);
    outline: none;
}
.btn-login {
    width: 100%; padding: 16px;
    background: linear-gradient(135deg, #4361ee, #3a0ca3);
    border: none; border-radius: 14px;
    color: white; font-weight: 700;
    cursor: pointer; transition: 0.3s;
}

/* === FOOTER === */
.footer-bar {
    width: 100%;
    padding: 20px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px; padding: 6px 16px;
    border: 1px solid var(--sky-blue);
    border-radius: 20px;
    font-size: 0.65rem; color: var(--sky-blue);
    text-transform: uppercase;
}
.status-dot {
    width: 7px; height: 7px;
    background: var(--sky-blue);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--sky-blue);
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* === INJECTION : CORRECTIFS MOBILES RESPONSIVES === */
@media (max-width: 600px) {
    .top-header {
        padding: 10px 15px;
        justify-content: center; /* Centrage des éléments sur petit écran */
        flex-wrap: wrap; /* Permet aux éléments de passer à la ligne si besoin */
        gap: 10px;
    }
    
    .logo-container h1 {
        font-size: 3rem; /* Réduction proportionnelle du titre */
    }
    
    .shortcuts-grid {
        gap: 10px; /* Réduction de l'espace entre les raccourcis */
    }
    
    .shortcut-item {
        width: 70px; /* Ajustement de la largeur des raccourcis */
    }
    
    .phone-frame {
        padding: 40px 20px 20px; /* Ajustement du padding interne */
        border-radius: 35px; /* Adoucissement des angles */
    }
}

/* ========================================================= */
/* === MODULE : CATALOGUE DES SERVICES (catalogue_services.php) */
/* ========================================================= */

.catalogue-wrapper {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 100px 20px 60px; /* Le padding top de 100px protège du header en position absolue */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.catalogue-title {
    font-size: 2.8rem;
    font-weight: 400;
    margin: 0 0 30px 0;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: -1px;
}

.catalogue-filter {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 50px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Grille CSS avancée : Auto-remplissage intelligent */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    width: 100%;
}

.service-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--search-bg);
    border: 1px solid var(--search-border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Effets de survol intelligents */
.service-card:hover {
    box-shadow: 0 2px 8px var(--search-shadow);
    border-color: transparent;
}

/* Correctif d'interaction spécifique pour le thème image (contour fluo) */
body.theme-img .service-card:hover {
    border-color: var(--sky-blue);
    background: rgba(255, 255, 255, 0.3);
}

.service-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Si l'utilisateur met une vraie image dans /logo/ */
.service-img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

/* Si le script génère une lettre colorée en fallback */
.service-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.service-name {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Logo d'action (Flèche sortante) */
.service-action {
    color: var(--sky-blue);
    opacity: 0.5; /* Discret par défaut */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.service-card:hover .service-action {
    opacity: 1; /* S'allume au survol */
}

/* Correctif Mobile pour le catalogue */
@media (max-width: 600px) {
    .catalogue-wrapper {
        padding-top: 120px;
    }
    .catalogue-title {
        font-size: 2.2rem;
    }
    .services-grid {
        grid-template-columns: 1fr; /* Une seule colonne sur téléphone */
    }
}