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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.input-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.url-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#recipeUrl {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

#recipeUrl:focus {
    border-color: var(--primary-color);
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.loading-message {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 1rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.error-message {
    padding: 12px 16px;
    background-color: #fee;
    color: var(--error-color);
    border-radius: 8px;
    border-left: 4px solid var(--error-color);
}

.recipe-output {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.recipe-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    flex: 1;
}

.recipe-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.saved-link-section {
    background-color: #ecfdf5;
    border: 2px solid var(--success-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.saved-link-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.saved-link-content span {
    font-weight: 600;
    color: var(--text-primary);
}

.saved-link-content input {
    flex: 1;
    min-width: 250px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    font-size: 0.9rem;
}

.recipe-summary {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-style: italic;
}

.recipe-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--bg-color);
    border-radius: 8px;
    font-size: 0.95rem;
}

.meta-item strong {
    color: var(--text-primary);
}

.recipe-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-top: 30px;
}

@media (max-width: 768px) {
    .recipe-content {
        grid-template-columns: 1fr;
    }

    .url-input-group {
        flex-direction: column;
    }

    .recipe-header {
        flex-direction: column;
        gap: 15px;
    }
}

.ingredients-section h3,
.instructions-section h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.ingredients-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ingredient-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    background-color: var(--bg-color);
    border-radius: 6px;
    transition: background-color 0.2s;
}

.ingredient-item:hover {
    background-color: #e2e8f0;
}

.ingredient-item input[type="checkbox"] {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.ingredient-item label {
    flex: 1;
    cursor: pointer;
    user-select: none;
}

.ingredient-item.checked label {
    text-decoration: line-through;
    color: var(--text-secondary);
    opacity: 0.6;
}

.instructions-list {
    counter-reset: step-counter;
    list-style: none;
    padding-left: 0;
}

.instructions-list li {
    counter-increment: step-counter;
    margin-bottom: 20px;
    padding-left: 45px;
    position: relative;
    line-height: 1.8;
}

.instructions-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--success-color);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
