/* Variables CSS pour la cohérence des couleurs */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --admin-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
}

/* Mode sombre */
[data-theme="dark"] {
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --background: #1a202c;
    --surface: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --border-color: #4a5568;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --admin-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input, textarea, [contenteditable="true"], .selectable {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Animations de fond */
@keyframes line-move {
    0% { transform: translateY(100vh); }
    100% { transform: translateY(-200px); }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

@keyframes drift {
    0% { transform: translateX(-100px) translateY(0px); }
    25% { transform: translateX(100px) translateY(-50px); }
    50% { transform: translateX(200px) translateY(0px); }
    75% { transform: translateX(100px) translateY(50px); }
    100% { transform: translateX(-100px) translateY(0px); }
}

/* Background animé - adapté pour les deux modes */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, var(--primary-color), var(--secondary-color), var(--accent-color), var(--primary-dark));
    background-size: 400% 400%;
    animation: gradient-shift 15s ease infinite;
    z-index: -2;
    opacity: 0.9;
    pointer-events: none;
}

/* Background clair animé avec violet, bleu, rose */
[data-theme="light"] body::before {
    background: linear-gradient(-45deg, 
        #c084fc 0%,    /* Violet saturé */
        #60a5fa 25%,   /* Bleu saturé */
        #f472b6 50%,   /* Rose saturé */
        #a78bfa 75%,   /* Violet lavande saturé */
        #38bdf8 100%   /* Bleu ciel saturé */
    );
    background-size: 400% 400%;
    animation: gradient-shift 20s ease infinite;
    opacity: 0.8;
    pointer-events: none;
}

/* Ciel étoilé pour le mode sombre */
[data-theme="dark"] body::before {
    background: 
        radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 160px 30px, rgba(255,255,255,0.8), transparent),
        radial-gradient(1px 1px at 200px 90px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 240px 50px, rgba(255,255,255,0.9), transparent),
        radial-gradient(1px 1px at 280px 20px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 320px 100px, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 360px 60px, rgba(255,255,255,0.6), transparent),
        linear-gradient(135deg, #0f1419 0%, #1a202c 50%, #2d3748 100%);
    background-size: 400px 400px, 400px 400px, 400px 400px, 400px 400px, 400px 400px, 
                     400px 400px, 400px 400px, 400px 400px, 400px 400px, 400px 400px, 100% 100%;
    animation: starry-sky 20s linear infinite;
}

@keyframes starry-sky {
    0% { background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0px 0px, 0% 0%; }
    100% { background-position: 400px 400px, -400px 400px, 400px -400px, -400px -400px, 400px 400px, -400px 400px, 400px -400px, -400px -400px, 400px 400px, -400px 400px, 0% 0%; }
}

/* Supprimer les anciennes particules */
body::after {
    display: none;
}

/* Traits verticaux */
.train {
    position: fixed;
    width: 2px;
    height: 150px;
    z-index: -1;
    animation: line-move 8s linear infinite;
    background: rgba(255, 255, 255, 0.3);
}

.train-1 {
    left: 20%;
    animation-delay: 0s;
}

.train-2 {
    left: 50%;
    animation-delay: 3s;
    animation-duration: 6s;
}

.train-3 {
    left: 75%;
    animation-delay: 1.5s;
    animation-duration: 10s;
}

/* Éléments décoratifs flottants */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.floating-element {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.floating-element:nth-child(1) {
    width: 60px;
    height: 60px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 8s;
}

.floating-element:nth-child(2) {
    width: 40px;
    height: 40px;
    top: 60%;
    left: 80%;
    animation-delay: 2s;
    animation-duration: 6s;
}

.floating-element:nth-child(3) {
    width: 80px;
    height: 80px;
    top: 80%;
    left: 20%;
    animation-delay: 4s;
    animation-duration: 10s;
}

.floating-element:nth-child(4) {
    width: 30px;
    height: 30px;
    top: 30%;
    left: 70%;
    animation-delay: 1s;
    animation-duration: 7s;
}

.floating-element:nth-child(5) {
    width: 50px;
    height: 50px;
    top: 70%;
    left: 60%;
    animation-delay: 3s;
    animation-duration: 9s;
}

/* Effet de pulsation sur les cartes d'applications */
.app-card {
    /* animation: pulse 4s ease-in-out infinite;
    animation-delay: calc(var(--index) * 0.2s); */
}

.app-card:hover {
    /* animation-play-state: paused; */
}

/* Écran de connexion */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.login-form label i {
    color: var(--primary-color);
    width: 16px;
}

.login-form input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
    color: var(--text-primary);
}

.login-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Mode sombre - Champs de texte d'authentification */
[data-theme="dark"] .login-form input {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .login-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: var(--surface);
}

[data-theme="dark"] .login-form input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: var(--danger-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: shake 0.5s ease;
}

.login-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

/* Boutons du modal d'authentification admin */
.btn-login {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-cancel {
    width: 100%;
    padding: 1rem;
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-cancel:hover {
    background: rgba(107, 114, 128, 0.2);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}

.btn-cancel:active {
    transform: translateY(0);
}

/* Informations utilisateur */
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.welcome-text {
    color: white;
    font-size: 0.9rem;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
    position: relative;
}

.header-top {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10;
}

/* Contrôles visiteur */
.visitor-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Menu admin complet */
.admin-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 1rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 280px;
    position: absolute;
    top: 0;
    right: 0;
}

.admin-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    justify-content: flex-end;
}

.admin-menu .user-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    justify-content: space-between;
}

.admin-menu .admin-toggle {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
}

.admin-login-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.admin-login-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.admin-login-btn i {
    font-size: 1.1rem;
}

/* Masquer les contrôles visiteur quand le menu admin est affiché */
.admin-menu:not([style*="display: none"]) ~ .visitor-controls {
    display: none;
}

/* Masquer le menu admin par défaut */
.admin-menu[style*="display: none"] {
    display: none !important;
}

.admin-mode .header-top {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.admin-mode .theme-toggle {
    order: 3;
}

.admin-mode .user-info {
    order: 2;
}

.admin-mode .admin-toggle {
    order: 1;
}

.admin-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.admin-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: var(--transition);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--admin-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 i {
    margin-right: 1rem;
    color: var(--accent-color);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Barre de recherche */
.search-container {
    margin-bottom: 3rem;
    display: flex;
    justify-content: center;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 2;
}

.search-box input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: none;
    border-radius: var(--border-radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
    color: var(--text-primary);
}

.search-box input:focus {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Adaptation pour le mode sombre */
[data-theme="dark"] .search-box input {
    color: white;
    background: var(--surface);
}

[data-theme="dark"] .search-box input::placeholder {
    color: var(--text-secondary);
}

[data-theme="dark"] .search-box i {
    color: var(--text-secondary);
}

/* Grille des applications */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.app-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transform: scaleX(0);
    transition: var(--transition);
}

.app-card:hover::before {
    transform: scaleX(1);
}

.app-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

/* Mode Admin - Overlay sur les cartes */
.admin-mode .app-card {
    border: 2px dashed transparent;
}

.admin-mode .app-card:hover {
    border-color: var(--admin-color);
    background: rgba(245, 158, 11, 0.05);
}

.admin-mode .app-card .admin-overlay {
    display: flex;
}

.admin-overlay {
    display: none;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    gap: 0.25rem;
}

.admin-overlay button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.admin-overlay button:hover {
    background: var(--admin-color);
    transform: scale(1.1);
}

.admin-overlay .delete-btn:hover {
    background: var(--danger-color);
}

.app-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.app-card:hover .app-icon {
    transform: scale(1.1) rotate(5deg);
}

.app-icon i {
    font-size: 1.5rem;
    color: white;
}

.app-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.app-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.app-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--background);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    padding: 0;
}

.btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

/* Panel d'administration */
.admin-panel {
    display: none;
    margin-bottom: 2rem;
}

.admin-mode .admin-panel {
    display: block;
    animation: slideDown 0.3s ease;
}

.admin-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.add-app-btn, .import-export-btn, .reset-btn {
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem 2rem;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.add-app-btn {
    border-color: var(--success-color);
    color: var(--success-color);
}

.add-app-btn:hover {
    background: var(--success-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.import-export-btn {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.import-export-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.reset-btn {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.reset-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Modal amélioré */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Formulaire amélioré */
form {
    padding: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Inputs et formulaires */
input, textarea, select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

input:focus, textarea:focus {
    caret-color: var(--primary-color);
}

.form-group input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Aperçu de l'icône */
.icon-preview {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
}

.icon-preview i {
    font-size: 1.5rem;
    color: white;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Bouton de sauvegarde pour le modal d'édition */
.btn-save {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-save:active {
    transform: translateY(0);
}

/* Import/Export Modal */
.import-export-content {
    padding: 2rem;
}

.export-section, .import-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.export-section h3, .import-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-section p, .import-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .login-card {
        padding: 2rem;
    }
    
    .header-top {
        position: static;
        justify-content: center;
        margin-bottom: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .app-card {
        padding: 1.5rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
    }
    
    .admin-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.5rem;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .search-box input {
        padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    }
    
    .app-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-secondary {
        width: 100%;
        height: auto;
        padding: 0.75rem;
    }
}

/* États cachés pour la recherche */
.app-card.hidden {
    display: none;
}

/* Animation de chargement */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Message aucun résultat */
.no-results {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.no-results-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.no-results-card i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    opacity: 0.6;
}

.no-results-card p {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 500;
}

/* Bouton de basculement de thème */
.theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.theme-toggle i {
    font-size: 1.1rem;
}

/* Quand l'admin est connecté mais pas en mode admin */
body:not(.admin-mode) .header-top:has(.user-info[style*="flex"]) {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

body:not(.admin-mode) .header-top:has(.user-info[style*="flex"]) .theme-toggle {
    order: 3;
}

body:not(.admin-mode) .header-top:has(.user-info[style*="flex"]) .user-info {
    order: 2;
}

body:not(.admin-mode) .header-top:has(.user-info[style*="flex"]) .admin-toggle {
    order: 1;
}

/* Drag & Drop en mode admin */
.admin-mode .app-card {
    cursor: grab;
    transition: var(--transition), transform 0.2s ease;
}

.admin-mode .app-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.admin-mode .app-card.dragging {
    cursor: grabbing;
    opacity: 0.8;
    transform: rotate(5deg) scale(1.05);
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.admin-mode .app-card.drag-over {
    transform: translateY(-8px) scale(0.95);
    border: 2px dashed var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

/* Indicateur de zone de drop */
.drop-indicator {
    width: 100%;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
    margin: 10px 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.drop-indicator.active {
    opacity: 1;
    animation: pulse-indicator 1s ease infinite;
}

@keyframes pulse-indicator {
    0%, 100% { opacity: 1; transform: scaleY(1); }
    50% { opacity: 0.7; transform: scaleY(1.5); }
}

/* Bouton de test Firebase */
.firebase-btn {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

.firebase-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #f7931e, #ff6b35);
}

.firebase-btn.testing {
    animation: pulse-firebase 1s ease infinite;
}

.firebase-btn.success {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.firebase-btn.error {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

@keyframes pulse-firebase {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Bouton de test Supabase - visible seulement en mode admin */
.supabase-test {
    display: none;
}

.admin-mode .supabase-test {
    display: block;
}

.supabase-btn {
    background: linear-gradient(135deg, #3ecf8e, #2dd4bf);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

.supabase-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #2dd4bf, #3ecf8e);
}

.supabase-btn.testing {
    animation: pulse-supabase 1s ease infinite;
}

.supabase-btn.success {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.supabase-btn.error {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

@keyframes pulse-supabase {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
