:root {
    --primary: #FF6B6B;
    --primary-hover: #FF5252;
    --secondary: #4ECDC4;
    --dark: #2D3436;
    --light: #F7F9FC;
    --white: #FFFFFF;
    --gray: #A0AEC0;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: #f0f4f8;
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

/* Dynamic Background */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: -1;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite ease-in-out alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(255,107,107,0.4) 0%, rgba(255,107,107,0) 70%);
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(78,205,196,0.4) 0%, rgba(78,205,196,0) 70%);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* Main Container - Glassmorphism */
.container {
    width: 100%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    position: relative;
    z-index: 1;
}

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

header h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

header p {
    color: var(--gray);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.api-notice {
    font-size: 0.85rem;
    color: #f39c12;
    margin-top: 0.5rem;
}

.api-key-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.api-key-input {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    width: 250px;
    outline: none;
    transition: var(--transition);
}

.api-key-input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2);
}

.api-key-help {
    color: var(--gray);
    font-size: 1.2rem;
    transition: var(--transition);
}

.api-key-help:hover {
    color: var(--primary);
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.input-group {
    display: flex;
    gap: 0.8rem;
}

input[type="text"] {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid white;
    border-radius: var(--radius-full);
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

input[type="text"]:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(78, 205, 196, 0.2);
}

/* Buttons */
button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    outline: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
}

.btn-primary {
    background-color: var(--secondary);
    color: white;
    padding: 0 1.5rem;
    border-radius: var(--radius-full);
    font-size: 1rem;
    box-shadow: 0 4px 14px 0 rgba(78, 205, 196, 0.39);
}

.btn-primary:hover {
    background-color: #45b8b0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

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

.btn-search {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    color: white;
    padding: 1rem;
    border-radius: var(--radius-full);
    font-size: 1.1rem;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    opacity: 1;
}

.btn-search:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5);
}

.btn-search:disabled {
    background: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Chips */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    min-height: 40px;
}

.chip {
    background-color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid #edf2f7;
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes scaleIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.chip-text {
    font-weight: 500;
}

.chip-delete {
    background: none;
    color: var(--gray);
    font-size: 1rem;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.chip-delete:hover {
    color: var(--primary);
    transform: scale(1.2);
}

/* Results Section */
.results-section {
    position: relative;
    min-height: 300px;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--gray);
    width: 100%;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--secondary);
    z-index: 10;
}

.loader i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.loader.hidden, .empty-state.hidden {
    display: none;
}

.spin {
    animation: spin 1s linear infinite;
}

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

/* Recipe Grid */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    padding-top: 1rem;
}

.recipe-card {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid #f0f4f8;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

.recipe-card:nth-child(1) { animation-delay: 0.1s; }
.recipe-card:nth-child(2) { animation-delay: 0.2s; }
.recipe-card:nth-child(3) { animation-delay: 0.3s; }
.recipe-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.recipe-img-wrapper {
    width: 100%;
    height: 160px;
    overflow: hidden;
    position: relative;
}

.recipe-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.recipe-card:hover .recipe-img {
    transform: scale(1.05);
}

.recipe-details {
    padding: 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.recipe-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: var(--dark);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray);
}

.recipe-link {
    margin-top: 1rem;
    display: block;
    text-align: center;
    padding: 0.6rem;
    background-color: var(--light);
    color: var(--secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
}

.recipe-link:hover {
    background-color: var(--secondary);
    color: white;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .btn-primary {
        padding: 1rem;
    }
}
