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

html {
    width: 100%;
    overflow-x: hidden;
}

/* Éviter les débordements */
img, video, iframe, object, embed {
    max-width: 100%;
    height: auto;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    overflow-x: hidden;
    width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
}

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

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Sections */
.form-section, .history-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.form-section h2, .history-section h2 {
    color: #4a5568;
    margin-bottom: 25px;
    font-size: 1.8rem;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* Formulaire */
.oil-form {
    display: grid;
    gap: 20px;
    max-width: 600px;
    width: 100%;
    box-sizing: border-box;
}

.form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #4a5568;
    font-size: 1.1rem;
}

.form-group input,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8fafc;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-help {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 5px;
    font-style: italic;
}

/* Section photos */
.photo-section {
    display: grid;
    gap: 20px;
    margin-top: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.photo-group {
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    background: #f8fafc;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.photo-group:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.photo-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #4a5568;
}

.photo-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.photo-input-container input[type="file"] {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.btn-camera {
    padding: 8px 15px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.btn-camera:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-camera:active {
    background: #4c51bf;
    transform: translateY(0);
}

.photo-preview {
    margin-top: 10px;
    min-height: 100px;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7fafc;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.photo-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.photo-preview .photo-placeholder {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
}

.photo-preview .remove-photo {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-preview .remove-photo:hover {
    background: #c53030;
}

/* Photos dans l'historique */
.history-photos {
    margin-top: 15px;
    display: grid;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.history-photo {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    background: #f8fafc;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.history-photo:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.history-photo-label {
    display: block;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.history-photo-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    object-fit: cover;
}

.history-photo-img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.history-photo-img.expanded {
    max-height: none;
    height: auto;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    z-index: 10;
    position: relative;
}

/* Boutons */
.btn-primary, .btn-secondary {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

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

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

.btn-secondary:active {
    background: #e2e8f0;
    border-color: #a0aec0;
}

/* Statistiques */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Contrôles d'historique */
.history-controls {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

/* Liste d'historique */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-date {
    font-weight: 600;
    color: #4a5568;
    font-size: 1.1rem;
}

.history-quantity {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.history-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 10px;
}

.history-detail {
    display: flex;
    flex-direction: column;
}

.history-detail-label {
    font-size: 0.8rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.history-detail-value {
    font-weight: 600;
    color: #4a5568;
}

.history-notes {
    background: #edf2f7;
    padding: 10px;
    border-radius: 6px;
    font-style: italic;
    color: #4a5568;
    margin-top: 10px;
}

/* Message vide */
.empty-history {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 40px;
    background: #f8fafc;
    border-radius: 10px;
    border: 2px dashed #e2e8f0;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    header {
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .form-section, .history-section {
        padding: 20px;
        margin-bottom: 20px;
        border-radius: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .form-section h2, .history-section h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .stats {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .history-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .history-controls {
        text-align: center;
        margin-bottom: 20px;
    }
    
    .btn-secondary {
        margin: 0 5px 10px 5px;
        width: calc(100% - 10px);
        max-width: calc(100% - 10px);
        padding: 15px 20px;
        font-size: 1rem;
        box-sizing: border-box;
    }
    
    .btn-primary {
        width: calc(100% - 10px);
        max-width: calc(100% - 10px);
        padding: 15px 20px;
        font-size: 1.1rem;
        margin: 10px 5px 0 5px;
        box-sizing: border-box;
    }
    
    .btn-camera {
        width: calc(100% - 10px);
        max-width: calc(100% - 10px);
        padding: 12px 15px;
        font-size: 1rem;
        margin: 8px 5px 0 5px;
        box-sizing: border-box;
    }
    
    .photo-input-container {
        flex-direction: column;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .photo-input-container input[type="file"] {
        width: calc(100% - 10px);
        max-width: calc(100% - 10px);
        padding: 12px;
        font-size: 1rem;
        margin: 0 5px;
        box-sizing: border-box;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 15px;
        font-size: 1rem;
        margin: 0 5px;
        width: calc(100% - 10px);
        max-width: calc(100% - 10px);
        box-sizing: border-box;
    }
    
    .form-group label {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .history-item {
        padding: 15px;
    }
    
    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .history-quantity {
        align-self: flex-start;
    }
    
    .history-photo-img {
        max-height: 150px;
    }
    
    .history-photos {
        margin-top: 10px;
        gap: 10px;
    }
    
    .history-photo {
        padding: 12px;
    }
    
    .history-photo-label {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
        text-align: center;
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

/* Styles pour très petits écrans (smartphones) */
@media (max-width: 480px) {
    .container {
        padding: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .form-section, .history-section {
        padding: 18px;
        margin-bottom: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .form-section h2, .history-section h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-number {
        font-size: 1.3rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    .btn-camera {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 12px;
        font-size: 0.95rem;
        margin: 0 5px;
        width: calc(100% - 10px);
        max-width: calc(100% - 10px);
        box-sizing: border-box;
    }
    
    .form-group label {
        font-size: 0.95rem;
    }
    
    .history-item {
        padding: 12px;
    }
    
    .history-date {
        font-size: 1rem;
    }
    
    .history-quantity {
        font-size: 0.9rem;
        padding: 4px 10px;
    }
    
    .history-detail-label {
        font-size: 0.75rem;
    }
    
    .history-detail-value {
        font-size: 0.9rem;
    }
    
    .history-photo-img {
        max-height: 120px;
    }
    
    .history-photos {
        margin-top: 8px;
        gap: 8px;
    }
    
    .history-photo {
        padding: 10px;
    }
    
    .history-photo-label {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    
    .photo-preview {
        min-height: 80px;
    }
    
    .photo-group {
        padding: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .photo-section {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .form-group {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .photo-group label {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
}

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

.history-item {
    animation: fadeIn 0.5s ease-out;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #48bb78;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

