/* Styles personnalisés pour l'application */

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

/* Toast notifications */
.toast {
    animation: slideIn 0.3s ease-out;
    min-width: 300px;
    max-width: 500px;
}

.toast.removing {
    animation: slideIn 0.3s ease-out reverse;
}

/* Modal */
.modal-backdrop {
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: slideDown 0.3s ease-out;
}

/* Cards hover effect */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Status badges */
.status-present {
    background-color: #10b981;
    color: white;
}

.status-absent {
    background-color: #ef4444;
    color: white;
}

.status-excuse {
    background-color: #f59e0b;
    color: white;
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Table styles */
.table-container {
    overflow-x: auto;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.table-container table {
    min-width: 100%;
}

.table-container th {
    background-color: #f9fafb;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.table-container tbody tr:hover {
    background-color: #f9fafb;
}

/* Form inputs */
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Buttons */
.btn {
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

/* Stats cards */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card-blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.stat-card-orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card-red {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Mobile Menu Animation */
@keyframes slideInDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#mobile-menu {
    animation: slideInDown 0.3s ease-out;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    /* Toast notifications */
    .toast {
        min-width: 250px;
        max-width: calc(100vw - 2rem);
    }
    
    /* Modal responsive */
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 1rem;
    }
    
    /* Buttons mobile */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Cards mobile */
    .card-hover {
        margin-bottom: 1rem;
    }
    
    /* Tables mobile - Card view */
    .table-container {
        border-radius: 0;
        box-shadow: none;
    }
    
    /* Form inputs mobile */
    input, select, textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Stat cards mobile */
    .stat-card, .stat-card-green, .stat-card-blue, .stat-card-orange, .stat-card-red {
        margin-bottom: 1rem;
    }
}

/* Extra small screens */
@media (max-width: 375px) {
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
}

/* Touch-friendly */
@media (hover: none) and (pointer: coarse) {
    .btn, button, a {
        min-height: 44px; /* iOS recommended touch target */
        min-width: 44px;
    }
    
    .card-hover:hover {
        transform: none; /* Disable hover effects on touch */
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile scrollbar (thinner) */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Safe area for notch devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* Pull to refresh prevention */
body {
    overscroll-behavior-y: contain;
}

/* Modern glassmorphism effect */
.glass-effect {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Skeleton loading */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 0px, #f8f8f8 40px, #f0f0f0 80px);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
}

/* Mobile-specific button groups */
@media (max-width: 768px) {
    /* Stack buttons vertically on mobile */
    .flex.space-x-3 {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .flex.space-x-3 > * {
        width: 100%;
        justify-content: center;
    }
    
    /* Selection actions bar */
    #selection-actions, #selection-actions-entrainements {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    #selection-actions .flex.space-x-2,
    #selection-actions-entrainements .flex.space-x-2 {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    #selection-actions .flex.space-x-2 > *,
    #selection-actions-entrainements .flex.space-x-2 > * {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 120px;
    }
}

/* Mobile card layout for tables */
@media (max-width: 640px) {
    .table-container table {
        display: block;
    }
    
    .table-container thead {
        display: none;
    }
    
    .table-container tbody {
        display: block;
    }
    
    .table-container tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 1rem;
        background: white;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .table-container td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .table-container td:last-child {
        border-bottom: none;
    }
    
    .table-container td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        margin-right: 1rem;
    }
    
    /* Hide selection column on mobile in card view */
    .selection-column {
        display: none !important;
    }
}

/* Floating Action Button for mobile */
.fab-mobile {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    transition: all 0.3s ease;
}

.fab-mobile:active {
    transform: scale(0.95);
}

@media (min-width: 769px) {
    .fab-mobile {
        display: none;
    }
}

/* Bottom navigation for mobile */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 0.5rem;
    display: none;
    z-index: 50;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        justify-content: space-around;
    }
    
    body {
        padding-bottom: 70px; /* Space for bottom nav */
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.2s;
    flex: 1;
    max-width: 80px;
}

.bottom-nav-item.active {
    color: #3b82f6;
}

.bottom-nav-item i {
    margin-bottom: 0.25rem;
}

.bottom-nav-item span {
    font-size: 0.625rem;
    font-weight: 500;
}
