/* RecipePro Scaler - Styles */
/* ========================= */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* Contenu principal */
.tool-content {
    padding: 20px 0;
    display: grid;
    gap: 20px;
}

/* Cards */
.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    font-weight: 600;
}

.card h3 i {
    color: #3498db;
}

.card h4 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1em;
    font-weight: 500;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    margin-bottom: 0;
}

/* Configuration Grid */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-control:focus {
    border-color: #3498db;
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

input.form-control:read-only {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* Boutons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn.btn-secondary {
    background: linear-gradient(145deg, #95a5a6, #7f8c8d);
}

.btn.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.3);
}

.btn.btn-success {
    background: linear-gradient(145deg, #27ae60, #229954);
}

.btn.btn-success:hover {
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.3);
}

.btn.btn-danger {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
}

.btn.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-icon:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

.btn-icon.remove-btn:hover {
    background: #e74c3c;
}

/* Liste des ingrédients */
.ingredients-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ingredient-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.ingredient-row:hover {
    background: #e9ecef;
    border-color: #3498db;
}

.ingredient-info {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 8px;
    align-items: center;
}

/* Champ d'unité personnalisée */
.ingredient-unit-custom {
    width: 100px;
    font-size: 13px;
    padding: 8px 10px;
}

.ingredient-actions {
    display: flex;
    gap: 8px;
}

.scaled-amount {
    text-align: right;
    font-weight: 600;
    color: #2c3e50;
    min-width: 100px;
}

.scaled-value {
    font-size: 16px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: inline-block;
}

/* Section résultats */
.results-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.scaled-recipe {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    min-height: 100px;
}

.no-ingredients, .no-history {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
}

.recipe-summary {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
}

.recipe-summary h4 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.recipe-ingredients {
    display: grid;
    gap: 8px;
}

.recipe-ingredient {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.recipe-ingredient:last-child {
    border-bottom: none;
}

/* Instructions et métadonnées de recette */
.recipe-instructions {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.recipe-instructions h5 {
    color: #28a745;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1em;
}

.recipe-instructions ol {
    margin-left: 20px;
    line-height: 1.6;
}

.recipe-instructions li {
    margin-bottom: 8px;
    color: #2c3e50;
}

.recipe-meta {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e9ecef;
    color: #495057;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

/* Convertisseur */
.conversion-tools {
    display: grid;
    gap: 30px;
}

.quick-converter {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.converter-input {
    display: grid;
    grid-template-columns: 1fr 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.converter-input i {
    color: #3498db;
    font-size: 16px;
    text-align: center;
}

.ingredient-selector {
    margin-bottom: 15px;
}

.ingredient-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
    color: #2c3e50;
}

.conversion-result {
    margin-top: 10px;
}

.conversion-result input {
    background: #e8f5e8;
    border-color: #28a745;
    font-weight: 500;
}

/* Ingrédient personnalisé */
.custom-ingredient-input {
    margin-top: 15px;
    padding: 15px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    animation: slideDown 0.3s ease-out;
}

.custom-ingredient-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: #2c3e50;
}

.custom-ingredient-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.custom-ingredient-controls input {
    flex: 1;
}

.btn-ai {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    min-width: 120px;
    justify-content: center;
}

.btn-ai:hover {
    background: linear-gradient(135deg, #4f46e5, #3730a3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn-ai:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-density-status {
    margin-top: 10px;
}

.ai-density-status .ai-loader {
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6366f1;
    font-size: 14px;
}

.ai-density-status .loader-dots {
    display: flex;
    gap: 3px;
}

.ai-density-status .loader-dots span {
    width: 6px;
    height: 6px;
    background: #6366f1;
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite both;
}

.ai-density-status .loader-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-density-status .loader-dots span:nth-child(2) { animation-delay: -0.16s; }

/* Alternatives */
.alternatives-panel {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.alternatives-list {
    display: grid;
    gap: 10px;
}

.alternative-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border-left: 3px solid #27ae60;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alternative-name {
    font-weight: 500;
    color: #2c3e50;
}

.alternative-ratio {
    font-size: 12px;
    color: #7f8c8d;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Historique */
.history-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.recipe-history {
    display: grid;
    gap: 15px;
}

.history-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

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

.history-title {
    font-weight: 600;
    color: #2c3e50;
}

.history-date {
    font-size: 12px;
    color: #7f8c8d;
}

.history-details {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 10px;
}

.history-actions-item {
    display: flex;
    gap: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
        border-radius: 10px;
    }
    
    .config-grid {
        grid-template-columns: 1fr;
    }
    
    .ingredient-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .ingredient-info {
        grid-template-columns: 1fr;
    }
    
    .ingredient-actions {
        justify-content: center;
    }
    
    .scaled-amount {
        text-align: center;
    }
    
    .converter-input {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .converter-input i {
        transform: rotate(90deg);
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .card-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .tool-content {
        padding: 10px 0;
    }
    
    .card {
        padding: 15px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 13px;
    }
}

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

.ingredient-row {
    animation: fadeIn 0.3s ease-out;
}

.alternative-item {
    animation: fadeIn 0.3s ease-out;
}

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

/* États spéciaux */
.highlight {
    border-color: #3498db !important;
    background: #ebf5ff !important;
}

.error {
    border-color: #e74c3c !important;
    background: #fdf2f2 !important;
}

.success {
    border-color: #27ae60 !important;
    background: #f0f8f4 !important;
}

/* Helper IA Intégré */
.ai-helper {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f0ff 100%);
    border: 1px solid #e3f2fd;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 25px;
    position: relative;
}

.ai-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6366f1;
    font-size: 14px;
    font-weight: 500;
    flex-wrap: wrap;
}

.ai-icon {
    font-size: 16px;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.btn-ai-quick, .btn-ai-describe {
    min-width: 32px;
    height: 32px;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    background: #6366f1;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    font-size: 12px;
    white-space: nowrap;
}

.btn-ai-quick:hover, .btn-ai-describe:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-ai-describe.active {
    background: #f59e0b;
}

.ai-input-area {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-input {
    flex: 1;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.ai-input:focus {
    border-color: #6366f1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-ai {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-ai:hover {
    background: linear-gradient(135deg, #4f46e5, #3730a3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

/* Status de génération IA */
.ai-loader {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    margin-top: 15px;
    color: #6366f1;
    font-weight: 500;
}

.loader-dots {
    display: flex;
    gap: 4px;
}

.loader-dots span {
    width: 8px;
    height: 8px;
    background: #6366f1;
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite both;
}

.loader-dots span:nth-child(1) { animation-delay: -0.32s; }
.loader-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes pulse {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Animations pour les notifications */
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Recette générée */
.ai-generated {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
    position: relative;
    animation: slideDown 0.4s ease-out;
}

.ai-generated h4 {
    color: #065f46;
    margin-bottom: 15px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-generated h4 i {
    color: #10b981;
}

.ai-recipe-preview {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    border-left: 4px solid #10b981;
}

.ai-recipe-title {
    font-weight: 600;
    color: #065f46;
    font-size: 16px;
    margin-bottom: 8px;
}

.ai-recipe-meta {
    display: flex;
    gap: 15px;
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 10px;
}

.ai-recipe-meta span {
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
}

.use-recipe-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.use-recipe-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

/* Section Génération Magique (ancienne - simplifiée) */
.magic-section {
    margin-bottom: 30px;
}

.magic-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
}

.magic-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: magicShimmer 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes magicShimmer {
    0%, 100% { transform: rotate(0deg) scale(1); opacity: 0.3; }
    50% { transform: rotate(180deg) scale(1.1); opacity: 0.1; }
}

.magic-card h3 {
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 2;
}

.magic-card h3 i {
    color: #ffd700;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

.magic-description {
    color: rgba(255,255,255,0.9);
    font-style: italic;
    text-align: center;
    margin-bottom: 25px;
    font-size: 16px;
    position: relative;
    z-index: 2;
}

.magic-options {
    display: grid;
    gap: 25px;
    position: relative;
    z-index: 2;
}

.magic-option {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.magic-option:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.magic-option p {
    color: rgba(255,255,255,0.8);
    margin: 10px 0 0 0;
    font-size: 14px;
    text-align: center;
}

.btn-magic {
    background: linear-gradient(145deg, #ffd700, #ffb700);
    color: #2c3e50;
    font-weight: 600;
    border: none;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 16px;
    position: relative;
    overflow: hidden;
    width: 100%;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    text-shadow: none;
}

.btn-magic::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: all 0.5s ease;
}

.btn-magic:hover::before {
    left: 100%;
}

.btn-magic:hover {
    background: linear-gradient(145deg, #ffed4a, #ffd700);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
}

.btn-magic i {
    margin-right: 10px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.custom-generation {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.magic-input {
    flex: 1;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.3);
    color: #2c3e50;
    font-weight: 500;
}

.magic-input::placeholder {
    color: #7f8c8d;
    font-style: italic;
}

.magic-input:focus {
    background: white;
    border-color: #ffd700;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.3);
}

.generation-status {
    text-align: center;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    margin-top: 20px;
    backdrop-filter: blur(10px);
}

.magic-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 16px;
    color: #ffd700;
    font-weight: 500;
}

.magic-loader i {
    font-size: 20px;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

.magic-generated {
    margin-top: 20px;
    padding: 20px;
    background: rgba(39, 174, 96, 0.2);
    border-radius: 10px;
    border-left: 4px solid #27ae60;
}

.magic-generated h4 {
    color: #ffd700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.magic-generated .recipe-details {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.use-recipe-btn {
    background: linear-gradient(145deg, #27ae60, #229954);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.use-recipe-btn:hover {
    background: linear-gradient(145deg, #2ecc71, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.3);
}

/* Responsive pour la section magique */
@media (max-width: 768px) {
    .custom-generation {
        flex-direction: column;
    }
    
    .magic-option {
        padding: 15px;
    }
    
    .btn-magic {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Tooltips */
[title] {
    position: relative;
}

/* Focus états pour accessibilité */
.btn:focus,
.form-control:focus,
.btn-icon:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .container {
        box-shadow: none;
        margin: 0;
        background: white;
    }
    
    .btn,
    .results-actions,
    .history-actions,
    .ingredient-actions {
        display: none;
    }
}
