/* Animations */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}
.ping {
    animation: pulse 2s infinite;
}
.glow {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.7);
}

/* Modal styles */
.modal {
    transition: all 0.3s ease;
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
}
.modal-active {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Hide login screen */
.login-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    z-index: -9999 !important;
}

/* Card styles */
.agent-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Background styles */
.circuit-bg {
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}
.circuit-bg::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 30%, rgba(16, 185, 129, 0.05) 0%, transparent 20%);
    z-index: -2; /* Mis derrière l'animation des têtes */
}
.circuit-bg::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><circle cx="25" cy="25" r="1" fill="%233b82f6" opacity="0.2"/><circle cx="75" cy="25" r="1" fill="%233b82f6" opacity="0.2"/><circle cx="25" cy="75" r="1" fill="%233b82f6" opacity="0.2"/><circle cx="75" cy="75" r="1" fill="%233b82f6" opacity="0.2"/></svg>');
    opacity: 0.1;
    z-index: -2; /* Mis derrière l'animation des têtes */
    animation: moveBackground 60s linear infinite;
}
@keyframes moveBackground {
    0% { background-position: 0 0; }
    100% { background-position: 100px 100px; }
}

/* Login container */
.login-container {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
}

/* Sidebar */
.sidebar {
    transition: all 0.3s ease;
}

/* Main content container - allow scrolling */
.main-content-container {
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
}

/* Fix scroll for dashboard content */
#app-container {
    height: 100vh;
    overflow-y: auto;
}

/* Animated AI Heads */
.ai-head-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.ai-head {
    position: absolute;
    color: rgba(59, 130, 246, 0.1);
    animation: float 20s linear infinite;
    font-size: 2rem;
}

.ai-head-1 {
    top: 10%;
    left: 15%;
    animation-delay: 0s;
    animation-duration: 25s;
}

.ai-head-2 {
    top: 30%;
    right: 20%;
    animation-delay: -5s;
    animation-duration: 30s;
}

.ai-head-3 {
    bottom: 25%;
    left: 10%;
    animation-delay: -10s;
    animation-duration: 22s;
}

.ai-head-4 {
    top: 60%;
    right: 15%;
    animation-delay: -15s;
    animation-duration: 28s;
}

.ai-head-5 {
    bottom: 10%;
    right: 30%;
    animation-delay: -20s;
    animation-duration: 26s;
}

.ai-head-6 {
    top: 80%;
    left: 25%;
    animation-delay: -25s;
    animation-duration: 24s;
}

@keyframes float {
    0% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.1;
    }
    25% {
        opacity: 0.3;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.1;
    }
    75% {
        opacity: 0.2;
    }
    100% {
        transform: translateY(0px) rotate(360deg);
        opacity: 0.1;
    }
}
/* Responsive design improvements */
@media (max-width: 768px) {
    .ai-head {
        font-size: 1.5rem;
    }
    
    .main-content-container {
        margin-left: 0;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
}

/* Mobile-first responsive design */
@media (max-width: 640px) {
    /* Container adjustments */
    .main-content-container {
        margin-left: 0;
        padding: 0;
    }
    
    .p-6 {
        padding: 1rem;
    }
    
    /* Sidebar mobile */
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* Header adjustments */
    header {
        padding: 0.75rem;
    }
    
    /* Grid adjustments */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
    
    .md\:grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
    
    /* Card adjustments */
    .agent-card {
        padding: 1rem;
    }
    
    .agent-card .w-16 {
        width: 3rem;
        height: 3rem;
    }
    
    .agent-card .text-xl {
        font-size: 1.125rem;
    }
    
    /* Modal adjustments */
    .modal {
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content {
        padding: 1rem;
    }
    
    /* Form adjustments */
    input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    /* Button adjustments */
    .btn, button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Table adjustments */
    .overflow-x-auto {
        overflow-x: auto;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    /* Navigation adjustments */
    nav a {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    /* AI heads mobile */
    .ai-head {
        font-size: 1rem;
    }
    
    /* Typography adjustments */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.125rem;
    }
    
    .text-2xl {
        font-size: 1.5rem;
    }
    
    .text-xl {
        font-size: 1.25rem;
    }
}

/* Tablet responsive */
@media (min-width: 641px) and (max-width: 1024px) {
    .sidebar {
        width: 16rem;
    }
    
    .main-content-container {
        margin-left: 16rem;
    }
    
    .grid {
        gap: 1.5rem;
    }
    
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 50;
        background: rgba(31, 41, 55, 0.9);
        border: 1px solid rgba(75, 85, 99, 0.5);
        border-radius: 0.5rem;
        padding: 0.5rem;
        backdrop-filter: blur(10px);
    }
    
    .mobile-menu-toggle i {
        color: white;
        font-size: 1.25rem;
    }
}

/* Touch-friendly improvements */
@media (max-width: 768px) {
    .agent-card {
        min-height: 120px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .agent-card:hover {
        transform: translateY(-2px);
    }
    
    /* Improve tap targets */
    a, button, [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better spacing for mobile */
    .space-y-2 > * + * {
        margin-top: 0.5rem;
    }
    
    .space-y-4 > * + * {
        margin-top: 1rem;
    }
    
    .space-y-6 > * + * {
        margin-top: 1.5rem;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 14rem;
    }
    
    .p-6 {
        padding: 0.75rem;
    }
    
    .agent-card {
        padding: 0.75rem;
    }
}

/* Safe area for modern phones */
@supports (padding: max(0px)) {
    .main-content-container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Scroll improvements for mobile */
@media (max-width: 768px) {
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    .overflow-y-auto {
        -webkit-overflow-scrolling: touch;
    }
}
/* Loading states mobile */
@media (max-width: 768px) {
    .loading {
        min-height: 200px;
    }
}

/* Form validation styles */
.form-error {
    border-color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
}

.form-success {
    border-color: #10b981 !important;
    background-color: rgba(16, 185, 129, 0.1) !important;
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Button states */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5b626e, #374151);
    transform: translateY(-2px);
}

/* Tab content */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Switch styles */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4b5563;
    transition: .4s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: #3b82f6;
}
input:checked + .slider:before {
    transform: translateX(26px);
}

/* Animation pour les têtes d'IA */
.ai-head-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}
.ai-head {
    position: absolute;
    font-size: 2rem;
    color: rgba(59, 130, 246, 0.3);
    animation: gravitate 20s infinite linear;
    opacity: 0;
}

@keyframes gravitate {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(calc(100vw * var(--tx)), calc(100vh * var(--ty))) rotate(360deg);
        opacity: 0;
    }
}

/* Styles spécifiques pour chaque tête */
.ai-head-1 { top: 10%; left: 15%; animation-delay: 0s; --tx: 0.7; --ty: 0.6; font-size: 1.5rem; }
.ai-head-2 { top: 70%; left: 10%; animation-delay: 3s; --tx: 0.8; --ty: -0.5; font-size: 2.5rem; }
.ai-head-3 { top: 40%; left: 80%; animation-delay: 6s; --tx: -0.6; --ty: 0.4; font-size: 2rem; }
.ai-head-4 { top: 85%; left: 60%; animation-delay: 9s; --tx: -0.4; --ty: -0.7; font-size: 1.8rem; }
.ai-head-5 { top: 20%; left: 50%; animation-delay: 12s; --tx: 0.3; --ty: 0.7; font-size: 2.2rem; }
.ai-head-6 { top: 5%; left: 90%; animation-delay: 15s; --tx: -0.8; --ty: 0.8; font-size: 1.7rem; }
