/* ==================== */
/* Smart Recipe - Static Version CSS */
/* ==================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700&display=swap');

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Main Container - Wider for Desktop */
.container {
    max-width: 1000px;
    /* 680px -> 1000px 확대 */
    margin: 0 auto;
    padding: 30px;
    transition: max-width 0.3s ease;
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
}

/* Header */
header {
    text-align: center;
    padding: 24px 0;
    color: white;
    position: relative;
}

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

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

/* API Key Banner */
.api-key-banner {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.banner-icon {
    font-size: 1.3rem;
}

.banner-text {
    color: white;
    font-weight: 600;
}

.api-key-banner.configured {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.btn-light {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #333 !important;
}

.btn-light:hover {
    background: white !important;
}

/* Steps Indicator */
.steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.step.active {
    color: white;
}

.step.completed {
    color: #90EE90;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.step.completed .step-number {
    background: #90EE90;
    color: #333;
}

.step-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.step-line {
    width: 36px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 12px;
    border-radius: 2px;
}

.step.completed+.step-line {
    background: #90EE90;
}

/* Main Content */
main {
    background: white;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
}

section {
    margin-bottom: 28px;
}

section:last-child {
    margin-bottom: 0;
}

h2 {
    font-size: 1.3rem;
    margin-bottom: 14px;
    color: #333;
}

.section-desc {
    color: #666;
    font-size: 0.92rem;
    margin-bottom: 16px;
}

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

.section-header h2 {
    margin-bottom: 0;
}

/* Upload Area */
/* Upload Area & Preview Integration */
.upload-container {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #f9f9f9;
}

.upload-area {
    border: 3px dashed #ddd;
    /* 점선 테두리는 그대로 유지하되 */
    border-radius: 16px;
    padding: 60px 40px;
    /* 패딩을 늘려 시원하게 */
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    /* 배경 투명 */
    position: relative;
    z-index: 10;
}

/* 이미지가 있을 때 upload-area 스타일 변경 */
.upload-area.has-image {
    padding: 0;
    border: none;
}

.upload-area.has-image .upload-content {
    display: none;
    /* 텍스트 내용 숨김 */
}

/* Preview Image within Area */
.preview-container {
    margin-top: 0;
    /* margin 제거 */
    text-align: center;
    line-height: 0;
    position: relative;
}

#previewImage {
    width: 100%;
    /* 높이는 auto로 두되 max-height 설정 */
    max-height: 500px;
    object-fit: contain;
    /* 비율 유지 */
    background: #000;
    /* 이미지 배경 */
    border-radius: 16px;
}

/* Remove button overlay */
#removeImage {
    position: absolute;
    top: 15px;
    right: 15px;
    margin-top: 0 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    color: white !important;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 20;
    padding: 8px 16px;
    border-radius: 20px;
}

#removeImage:hover {
    background: rgba(0, 0, 0, 0.8) !important;
    transform: scale(1.05);
}

/* Buttons - Enhanced for Touch */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 28px;
    /* 터치 영역 확대 */
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    /* 가독성 향상 */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    margin-top: 14px;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
    /* 클릭 피드백 */
}

/* Accessibility Focus Ring */
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #f0f0f0 0%, #e8e8e8 100%);
    color: #333;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #e8e8e8 0%, #ddd 100%);
    transform: translateY(-2px);
}

.btn-save {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(56, 239, 125, 0.3);
}

.btn-save:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(56, 239, 125, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

.btn-small {
    padding: 10px 18px;
    width: auto;
    margin-top: 0;
    font-size: 0.9rem;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* Skeleton Loading Animation */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Ingredients */
.ingredients-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    min-height: 44px;
}

.ingredient-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #f0f0ff 0%, #e8e8ff 100%);
    border: 2px solid #667eea;
    color: #667eea;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.ingredient-tag:hover {
    background: #667eea;
    color: white;
    transform: scale(1.02);
}

.ingredient-tag .remove {
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.ingredient-tag .remove:hover {
    opacity: 1;
}

/* Add Ingredient */
.add-ingredient {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.add-ingredient input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.add-ingredient input:focus {
    border-color: #667eea;
}

/* Selected Ingredients */
.selected-ingredients {
    margin-bottom: 18px;
    padding: 14px;
    background: linear-gradient(135deg, #f8f8f8 0%, #f5f5f5 100%);
    border-radius: 12px;
}

.selected-ingredients label {
    font-weight: 600;
    font-size: 0.88rem;
    color: #555;
    display: block;
    margin-bottom: 10px;
}

.ingredients-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ingredients-preview .tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 0.82rem;
    font-weight: 500;
}

/* Recipe Options */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-group label {
    font-weight: 600;
    font-size: 0.88rem;
    color: #555;
}

.option-group select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.option-group select:focus {
    border-color: #667eea;
}

/* Recipe Card */
.recipe-card {
    background: linear-gradient(135deg, #f8f8f8 0%, #f5f5f5 100%);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 18px;
}

.recipe-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid #eee;
}

.recipe-name {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 8px;
}

.recipe-description {
    color: #666;
    font-size: 0.95rem;
}

.recipe-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: white;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 0.88rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.recipe-section {
    margin-bottom: 18px;
}

.recipe-section h3 {
    font-size: 1.05rem;
    color: #333;
    margin-bottom: 12px;
}

.recipe-ingredients {
    list-style: none;
}

.recipe-ingredients li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    font-size: 0.92rem;
}

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

.recipe-ingredients .amount {
    color: #667eea;
    font-weight: 600;
}

.recipe-ingredients .unavailable {
    color: #e74c3c;
    font-size: 0.82rem;
}

.recipe-steps {
    padding-left: 22px;
}

.recipe-steps li {
    padding: 10px 0;
    padding-left: 10px;
    font-size: 0.92rem;
}

.recipe-steps li::marker {
    color: #667eea;
    font-weight: bold;
}

/* Tips Section */
.tips-section {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3cd 100%);
    padding: 14px;
    border-radius: 12px;
    border-left: 4px solid #ffc107;
    margin-bottom: 18px;
}

.tips-section h3 {
    color: #f57c00;
    margin-bottom: 8px;
}

.recipe-tips {
    color: #666;
    font-size: 0.92rem;
}

/* Recipe Notes */
.recipe-notes {
    margin-bottom: 18px;
}

.recipe-notes label {
    font-weight: 600;
    font-size: 0.92rem;
    display: block;
    margin-bottom: 10px;
}

.recipe-notes textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 0.92rem;
    resize: vertical;
    min-height: 90px;
    outline: none;
    transition: border-color 0.2s;
}

.recipe-notes textarea:focus {
    border-color: #667eea;
}

/* Recipe Actions */
.recipe-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recipe-actions .btn {
    margin-top: 0;
}

/* Saved Recipes */
.stats-bar {
    display: flex;
    gap: 24px;
    padding: 14px;
    background: linear-gradient(135deg, #f0f0ff 0%, #e8e8ff 100%);
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 0.92rem;
}

.recipes-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recipe-item {
    background: linear-gradient(135deg, #f8f8f8 0%, #f5f5f5 100%);
    border-radius: 12px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.recipe-item:hover {
    background: linear-gradient(135deg, #f0f0ff 0%, #e8e8ff 100%);
    transform: translateY(-3px);
    border-color: #667eea;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
}

.recipe-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recipe-item-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.recipe-item-date {
    font-size: 0.82rem;
    color: #999;
}

.recipe-item-meta {
    font-size: 0.88rem;
    color: #666;
    margin-top: 6px;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 36px;
    font-size: 0.95rem;
}

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

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 28px;
    width: 92%;
    max-width: 420px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-large {
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 22px;
    font-size: 1.6rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal h2 {
    margin-bottom: 22px;
}

.modal-desc {
    color: #666;
    font-size: 0.92rem;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #667eea;
}

.api-help {
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.88rem;
}

.api-help a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.api-help a:hover {
    text-decoration: underline;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.toast.error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 520px) {
    .container {
        padding: 14px;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 20px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .steps-indicator {
        flex-wrap: wrap;
        gap: 10px;
    }

    .step-line {
        display: none;
    }

    .recipe-meta {
        flex-direction: column;
        gap: 10px;
    }

    .stats-bar {
        flex-direction: column;
        gap: 10px;
    }

    .banner-content {
        flex-direction: column;
        text-align: center;
    }
}