/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* Sections */
section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

section h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #4a5568;
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #4a5568;
}

input[type="datetime-local"],
input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: #667eea;
}

/* Range slider pour intensité */
input[type="range"] {
    width: 100%;
    margin-bottom: 0.5rem;
}

.intensity-display {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
}

/* Boutons */
.btn-primary,
.btn-secondary,
.btn-danger {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.btn-secondary {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #edf2f7;
}

.btn-danger {
    background: #fc8181;
    color: white;
}

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

/* États d'enregistrement */
.recording-state {
    text-align: center;
    margin-bottom: 1.5rem;
}

.btn-large {
    font-size: 1.2rem;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    font-weight: bold;
}

.timer-display-large {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    text-align: center;
}

#activeTimerDisplay {
    font-size: 3rem;
    font-weight: bold;
    display: block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.manual-entry {
    margin-top: 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}

.manual-entry summary {
    font-weight: 600;
    cursor: pointer;
    color: #4a5568;
    padding: 0.5rem 0;
}

.manual-entry summary:hover {
    color: #667eea;
}

/* Guide de respiration */
.breathing-guide {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.breathing-triangle {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.triangle-shape {
    width: 80px;
    height: 80px;
    border: 3px solid #667eea;
    border-radius: 50%;
    position: relative;
    animation: breathingPulse 6s infinite ease-in-out;
}

.triangle-shape::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 25px solid #667eea;
    transform: translate(-50%, -60%);
    animation: triangleRotate 6s infinite ease-in-out;
}

.breathing-text {
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    animation: breathingTextFade 6s infinite ease-in-out;
}

.breathing-tip {
    color: #718096;
    font-size: 0.9rem;
    margin: 0;
}

/* Conseils de contraction */
.contraction-tips {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.tip-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-left: 4px solid #667eea;
    animation: slideInUp 0.5s ease-out;
}

.tip-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.tip-text {
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 500;
}

/* Animations */
@keyframes breathingPulse {
    0%, 100% {
        transform: scale(1);
        border-color: #667eea;
    }
    33% {
        transform: scale(1.3);
        border-color: #48bb78;
    }
    66% {
        transform: scale(1);
        border-color: #f6ad55;
    }
}

@keyframes triangleRotate {
    0%, 100% {
        transform: translate(-50%, -60%) rotate(0deg);
    }
    33% {
        transform: translate(-50%, -60%) rotate(120deg);
    }
    66% {
        transform: translate(-50%, -60%) rotate(240deg);
    }
}

@keyframes breathingTextFade {
    0%, 100% {
        opacity: 1;
        color: #667eea;
    }
    33% {
        opacity: 0.7;
        color: #48bb78;
    }
    66% {
        opacity: 1;
        color: #f6ad55;
    }
}

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

/* Statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-card {
    background: #f7fafc;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Contrôles de filtre */
.filter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-controls button {
    flex: 1;
    margin-bottom: 0;
}

/* Liste des contractions */
.contractions-list {
    max-height: 400px;
    overflow-y: auto;
}

.contraction-item {
    background: #f7fafc;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    border-left: 4px solid #667eea;
}

.contraction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.contraction-time {
    font-weight: bold;
    color: #4a5568;
}

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

.contraction-intensity {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.btn-edit {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn-edit:hover {
    background: #edf2f7;
}

.contraction-details {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #718096;
}

.empty-state {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 2rem;
}

/* Responsive */
@media (min-width: 768px) {
    .container {
        padding: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .filter-controls {
        justify-content: flex-end;
    }

    .filter-controls button {
        flex: none;
        width: auto;
        min-width: 150px;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contraction-item {
    animation: slideIn 0.3s ease-out;
}

/* États spéciaux */
.intensity-high {
    border-left-color: #fc8181 !important;
}

.intensity-medium {
    border-left-color: #f6ad55 !important;
}

.intensity-low {
    border-left-color: #68d391 !important;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #4a5568;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #a0aec0;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: #4a5568;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-footer button {
    width: auto;
    min-width: 100px;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .modal-footer {
        flex-direction: column;
    }

    .modal-footer button {
        width: 100%;
    }
}