/**
 * Styles CSS - Application CoolCare
 * Prestataire: Taaazzz-prog
 * Client: CoolCare
 * Mobile-first responsive design
 */

/* Variables CSS */
:root {
    --primary-color: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --light-bg: #f8fafc;
    --white: #ffffff;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.15s ease-in-out;
}

/* Reset et base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--light-bg);
    font-size: 16px;
}

/* ==========================================
   PAGE DE CONNEXION
   ========================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-placeholder h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.logo-placeholder p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--gray-800);
    font-size: 1.5rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    font-size: 0.875rem;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger-color);
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: var(--secondary-color);
    border: 1px solid #bbf7d0;
}

.login-help {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--gray-100);
    border-radius: var(--border-radius);
}

.login-help h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.login-help ul {
    list-style: none;
    font-size: 0.75rem;
    color: var(--gray-600);
}

.login-help li {
    margin-bottom: 0.25rem;
}

.login-footer {
    text-align: center;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

/* ==========================================
   LAYOUT GÉNÉRAL
   ========================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: between;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.user-name {
    font-weight: 500;
    color: var(--gray-700);
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: var(--gray-200);
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--gray-300);
}

/* ==========================================
   DASHBOARD
   ========================================== */

.main-content {
    padding: 2rem 0;
}

.dashboard-title {
    text-align: center;
    margin-bottom: 2rem;
}

.dashboard-title h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    color: var(--gray-600);
    font-size: 1rem;
}

.actions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.action-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    border: 1px solid var(--gray-200);
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.action-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.action-card p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.action-card.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--white);
}

.action-card.primary h3,
.action-card.primary p {
    color: var(--white);
}

.pending-actions-list {
    list-style: none;
    margin: 1rem 0 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 240px;
    overflow-y: auto;
}

.pending-actions-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    background: var(--gray-100);
}

.pending-actions-item__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.pending-actions-item__badge {
    background: var(--primary-light);
    color: var(--white);
    border-radius: var(--border-radius);
    padding: 0.15rem 0.6rem;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
}

.pending-actions-item__meta {
    margin-top: 0.35rem;
    color: var(--gray-600);
    font-size: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pending-actions-item__url {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--gray-500);
    word-break: break-word;
}

.pending-actions-item--empty {
    text-align: center;
    background: var(--white);
    border-style: dashed;
    color: var(--gray-600);
}

.pending-actions-refresh {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--primary-light);
    border-radius: var(--border-radius);
    background: var(--white);
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.pending-actions-refresh:hover:not(:disabled) {
    background: var(--primary-light);
    color: var(--white);
}

.pending-actions-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Conteneur des boutons */
.pending-actions-buttons {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
}

/* Bouton "Vider anciennes" - style cohérent avec refresh mais rouge clair */
.pending-actions-clear {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ffcccb;
    border-radius: var(--border-radius);
    background: #fff5f5;
    color: #d32f2f;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.pending-actions-clear:hover:not(:disabled) {
    background: #ffe0e0;
    border-color: #ff9999;
    color: #c62828;
}

.pending-actions-clear:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f5;
}

/* ==========================================
   FORMULAIRES
   ========================================== */

.form-container {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.form-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

/* Tablettes */
@media (min-width: 768px) {
    .login-card {
        padding: 3rem;
    }
    
    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-section {
        padding: 2rem;
    }
    
    .container {
        padding: 0 2rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .actions-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .form-grid.col-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .header-content {
        justify-content: space-between;
    }
}

/* Large desktop */
@media (min-width: 1280px) {
    .actions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==========================================
   UTILITAIRES
   ========================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }

.hidden { display: none; }
.block { display: block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }

.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* Couleurs de texte */
.text-primary { color: var(--primary-color); }
.text-success { color: var(--secondary-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
/* PWA status indicator */
.pwa-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(30, 136, 229, 0.12);
    color: #1e3a8a;
    font-size: 0.85rem;
}
.pwa-status__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #28a745;
    display: inline-block;
}
.pwa-status__dot[data-online='false'] {
    background: #dc3545;
}
.pwa-status[data-state='offline'] {
    background: rgba(220, 53, 69, 0.12);
    color: #b02128;
}
.pwa-status__queue {
    font-weight: 500;
}
.pwa-status__sync {
    border: none;
    background: transparent;
    color: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 999px;
}
.pwa-status__sync:hover {
    background: rgba(30, 136, 229, 0.15);
}
.pwa-status[data-error='true'] {
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.4);
}
.pwa-status__error {
    color: #b02128;
    font-weight: 600;
}

.status-bar {
    margin-top: 12px;
}

