/* ===== STYLES CSS (styles.css) ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    min-height: 100vh;
}

.view {
    display: block;
}

.view.hidden {
    display: none;
}

.icon {
    margin-right: 8px;
}

/* ===== HEADER ===== */
.header {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.title {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.sync-indicator {
    font-size: 0.8rem;
    margin-left: 0.5rem;
    opacity: 0.7;
    animation: rotate 2s linear infinite;
    transition: all 0.3s ease;
}

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

/* ===== BOUTONS ===== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-admin {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

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

.btn-success {
    background: #10b981;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-primary {
    background: #3b82f6;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-login {
    width: 100%;
    background: #ef4444;
    color: white;
}

.btn-login:hover {
    background: #dc2626;
}

.btn-link {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.3s ease;
}

.btn-link:hover {
    color: white;
}

/* ===== BOUTON ACTIVATION SON ===== */
.btn-sound {
    background: linear-gradient(45deg, #f59e0b, #d97706);
    color: white;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    transform: scale(1);
}

.btn-sound:hover {
    background: linear-gradient(45deg, #d97706, #b45309);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-sound:active {
    transform: scale(0.95);
}

.sound-activation {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(245, 158, 11, 0.1);
    border: 2px dashed rgba(245, 158, 11, 0.3);
    border-radius: 15px;
}

.sound-activation.hidden {
    display: none;
}

.sound-info {
    margin-top: 0.5rem;
    color: #fbbf24;
    font-size: 0.9rem;
    font-style: italic;
}

/* ===== BOUTON RESET SYSTÈME ===== */
.btn-system-reset {
    background: #7c2d12;
    color: white;
    border: 2px solid #dc2626;
    font-weight: bold;
}

.btn-system-reset:hover {
    background: #991b1b;
    border-color: #ef4444;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

.btn-system-reset:disabled {
    background: #6b7280;
    border-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== CHRONOMÈTRE ===== */
.main-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.timer-container {
    display: flex;
    justify-content: center;
    margin: 4rem 0;
}

.timer-display {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.time {
    font-size: 6rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: linear-gradient(45deg, #00d4ff, #0066ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1.2rem;
    color: #e5e7eb;
}

.indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.indicator.running {
    background: #10b981;
    animation: pulse 2s infinite;
}

.indicator.stopped {
    background: #ef4444;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== BOUTONS CONTRÔLE ========*/
.escape-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.escape-btn {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.escape-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.escape-btn:disabled:hover {
    transform: none;
}

@media (max-width: 768px) {
    .escape-controls {
        grid-template-columns: 1fr;
    }
}

/* ===== MESSAGES AGRANDIS ===== */
.messages-section {
    margin-top: 2rem;
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    text-align: center;
    justify-content: center;
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.message {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: scale(1);
    transition: all 0.3s ease;
}

.message:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.message-text {
    font-size: 1.6rem;
    line-height: 1.6;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.message-time {
    font-size: 1.1rem;
    color: #cbd5e1;
    margin-left: 2rem;
    font-weight: 400;
}

/* Animation d'apparition pour nouveaux messages */
.message.new-message {
    animation: messageAppear 0.5s ease-out;
}

@keyframes messageAppear {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== CONNEXION ===== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #111827;
}

.login-box {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

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

.login-icon {
    width: 64px;
    height: 64px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #9ca3af;
}

.demo-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3b82f6;
    border-radius: 8px;
    color: #60a5fa;
    font-size: 0.9rem;
}

.demo-info code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    text-align: center;
}

.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
}

.error-message {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.error-message.hidden {
    display: none;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
}

/* ===== ADMIN ===== */
.admin-header {
    background: #ef4444;
    padding: 1rem;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.admin-main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    background: #111827;
    min-height: calc(100vh - 80px);
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.admin-section {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 1.5rem;
}

.timer-admin {
    text-align: center;
}

.timer-display-admin {
    background: #000;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.time-admin {
    font-size: 2.5rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #00d4ff;
    margin-bottom: 1rem;
}

.timer-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* ===== CONTRÔLES SYSTÈME ===== */
.system-controls {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #374151;
}

.system-controls .btn-system-reset {
    width: 100%;
    justify-content: center;
    margin-bottom: 1rem;
}

.reset-warning {
    font-size: 0.8rem;
    color: #fbbf24;
    text-align: center;
    margin: 0;
    font-style: italic;
}

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

.message-form textarea {
    width: 100%;
    padding: 0.75rem;
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 8px;
    color: white;
    resize: vertical;
    margin-bottom: 1rem;
}

.message-form textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.admin-messages {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-message {
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 8px;
    padding: 0.75rem;
}

.admin-message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.admin-message-text {
    font-size: 0.9rem;
    flex: 1;
}

.admin-message-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.75rem;
}

.admin-message-time {
    font-size: 0.8rem;
    color: #9ca3af;
}

.delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.8rem;
}

.delete-btn:hover {
    color: #dc2626;
}

/* ===== STATUS INDICATORS ===== */
.connection-status {
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.connection-status.connected {
    color: #10b981;
}

.connection-status.disconnected {
    color: #ef4444;
    animation: none;
}

.connection-status.connecting {
    color: #f59e0b;
    animation: rotate 2s linear infinite;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .time {
        font-size: 3rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .admin-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .timer-controls {
        grid-template-columns: 1fr;
    }
    
    .system-controls .btn-system-reset {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .message-text {
        font-size: 1.3rem;
    }
    
    .message-time {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
}