/* 
 * Calculateur de Quantités - Secret de Pipelette
 * Mobile-first, design moderne et accessible
 */

:root {
    --sdp-primary: #d4a574;
    --sdp-primary-dark: #b8875a;
    --sdp-secondary: #f8f5f0;
    --sdp-accent: #e8b89a;
    --sdp-text: #2c2c2c;
    --sdp-text-light: #666;
    --sdp-border: #e0e0e0;
    --sdp-success: #68c896;
    --sdp-white: #ffffff;
    --sdp-shadow: rgba(0, 0, 0, 0.08);
    --sdp-shadow-lg: rgba(0, 0, 0, 0.12);
}

.sdp-calculateur-wrapper {
    background: var(--sdp-white);
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--sdp-shadow);
    margin: 2rem 0;
    padding: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Header */
.sdp-calc-header {
    background: linear-gradient(135deg, var(--sdp-primary) 0%, var(--sdp-primary-dark) 100%);
    padding: 1.5rem 1.25rem;
    text-align: center;
    color: var(--sdp-white);
}

.sdp-calc-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1.3;
}

.sdp-calc-icon {
    font-size: 1.5rem;
}

.sdp-calc-subtitle {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Body */
.sdp-calc-body {
    padding: 1.5rem 1.25rem;
}

/* Input groups */
.sdp-input-group {
    margin-bottom: 1.5rem;
}

.sdp-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--sdp-text);
    font-size: 0.9375rem;
}

.label-text {
    display: block;
}

.label-hint {
    display: block;
    font-size: 0.8125rem;
    color: var(--sdp-text-light);
    font-weight: 400;
    margin-top: 0.125rem;
}

/* Inputs */
.sdp-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--sdp-border);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--sdp-white);
    color: var(--sdp-text);
}

.sdp-input:focus {
    outline: none;
    border-color: var(--sdp-primary);
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

.sdp-input-highlight {
    background: var(--sdp-secondary);
    border-color: var(--sdp-primary);
    font-weight: 600;
    font-size: 1.125rem;
}

/* Input avec unité */
.input-with-unit {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.input-with-unit .sdp-input {
    flex: 1;
}

.sdp-select-unit {
    padding: 0.875rem 1rem;
    border: 2px solid var(--sdp-border);
    border-radius: 10px;
    font-size: 0.9375rem;
    background: var(--sdp-white);
    color: var(--sdp-text);
    min-width: 120px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sdp-select-unit:focus {
    outline: none;
    border-color: var(--sdp-primary);
}

.sdp-unit-display {
    padding: 0.875rem 1rem;
    background: var(--sdp-secondary);
    border-radius: 10px;
    font-size: 0.9375rem;
    color: var(--sdp-text-light);
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Arrow */
.sdp-arrow-down {
    text-align: center;
    margin: 1rem 0;
    color: var(--sdp-primary);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

/* Multiplier badge */
.sdp-multiplier {
    text-align: center;
    margin: 1.5rem 0;
}

.sdp-multiplier-badge {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--sdp-accent) 0%, var(--sdp-primary) 100%);
    color: var(--sdp-white);
    border-radius: 50px;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.sdp-multiplier-badge strong {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Converter */
.sdp-converter {
    margin: 2rem 0;
    border-top: 1px solid var(--sdp-border);
    padding-top: 1.5rem;
}

.sdp-converter-toggle {
    width: 100%;
    padding: 1rem;
    background: var(--sdp-secondary);
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--sdp-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.sdp-converter-toggle:hover {
    background: var(--sdp-border);
}

.sdp-converter-toggle .toggle-icon {
    transition: transform 0.3s ease;
}

.sdp-converter-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.sdp-converter-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sdp-converter-panel.open {
    max-height: 500px;
    margin-top: 1rem;
}

.sdp-converter-content {
    padding: 1rem;
    background: var(--sdp-secondary);
    border-radius: 10px;
}

.sdp-converter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.sdp-select {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--sdp-border);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--sdp-white);
    color: var(--sdp-text);
    cursor: pointer;
}

.sdp-arrow-right {
    color: var(--sdp-primary);
    font-size: 1.25rem;
    font-weight: bold;
}

.sdp-result {
    padding: 1rem;
    background: var(--sdp-white);
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: var(--sdp-primary);
    margin-top: 1rem;
    border: 2px dashed var(--sdp-border);
}

/* History */
.sdp-history {
    margin: 2rem 0;
    border-top: 1px solid var(--sdp-border);
    padding-top: 1.5rem;
}

.sdp-history-toggle {
    width: 100%;
    padding: 1rem;
    background: var(--sdp-white);
    border: 2px solid var(--sdp-border);
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--sdp-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.sdp-history-toggle:hover {
    border-color: var(--sdp-primary);
}

.history-count {
    background: var(--sdp-primary);
    color: var(--sdp-white);
    padding: 0.25rem 0.625rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sdp-history-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sdp-history-panel.open {
    max-height: 600px;
    margin-top: 1rem;
}

.sdp-history-list {
    background: var(--sdp-secondary);
    border-radius: 10px;
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.sdp-history-item {
    background: var(--sdp-white);
    padding: 0.875rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--sdp-primary);
}

.sdp-history-item:last-child {
    margin-bottom: 0;
}

.sdp-history-item-content {
    font-size: 0.875rem;
    color: var(--sdp-text);
    margin-bottom: 0.25rem;
}

.sdp-history-item-date {
    font-size: 0.75rem;
    color: var(--sdp-text-light);
}

.sdp-empty-state {
    text-align: center;
    color: var(--sdp-text-light);
    font-size: 0.875rem;
    padding: 2rem 1rem;
}

.sdp-clear-history {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.625rem;
    background: transparent;
    border: none;
    color: var(--sdp-text-light);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.sdp-clear-history:hover {
    color: var(--sdp-text);
}

/* Actions */
.sdp-actions {
    margin-top: 2rem;
    display: flex;
    gap: 0.75rem;
}

.sdp-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sdp-btn-primary {
    background: linear-gradient(135deg, var(--sdp-primary) 0%, var(--sdp-primary-dark) 100%);
    color: var(--sdp-white);
    box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.sdp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(212, 165, 116, 0.4);
}

.sdp-btn-primary:active {
    transform: translateY(0);
}

/* Responsive - Tablettes */
@media (min-width: 768px) {
    .sdp-calculateur-wrapper {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .sdp-calc-header {
        padding: 2rem;
    }
    
    .sdp-calc-title {
        font-size: 1.5rem;
    }
    
    .sdp-calc-body {
        padding: 2rem;
    }
    
    .sdp-converter-row {
        gap: 1rem;
    }
}

/* Responsive - Desktop */
@media (min-width: 1024px) {
    .sdp-calculateur-wrapper {
        max-width: 700px;
    }
    
    .sdp-input-group {
        margin-bottom: 2rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sdp-history-item {
    animation: fadeIn 0.3s ease;
}

/* Accessibilité */
.sdp-btn:focus,
.sdp-input:focus,
.sdp-select:focus,
.sdp-converter-toggle:focus,
.sdp-history-toggle:focus {
    outline: 2px solid var(--sdp-primary);
    outline-offset: 2px;
}

/* États de chargement */
.sdp-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Toast notifications */
.sdp-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--sdp-text);
    color: var(--sdp-white);
    padding: 1rem 1.5rem;
    border-radius: 50px;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    animation: slideUp 0.3s ease;
}

.sdp-toast.success {
    background: var(--sdp-success);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}