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

:root {
    --primary: #e67e22;
    --primary-dark: #d35400;
    --bg: #faf9f7;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #ecf0f1;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 16px;
    --radius-sm: 8px;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-add:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--primary);
}

/* Main */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Search */
.search-container {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.search-input {
    width: 100%;
    max-width: 600px;
    padding: 1rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    background-color: var(--card-bg);
    outline: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
}

/* Recipes Grid */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.recipe-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.recipe-card-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.recipe-card-content {
    padding: 1.25rem;
}

.recipe-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state svg {
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.modal-close:hover {
    background: white;
    transform: scale(1.1);
}

.modal-image img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.modal-content {
    padding: 2rem;
}

.modal-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.modal-section {
    margin-bottom: 2rem;
}

.modal-section h3 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.modal-section ul {
    list-style: none;
}

.modal-section li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.modal-section li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

.modal-section p {
    white-space: pre-line;
    color: var(--text);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #fff;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    flex: 1;
}

.btn-delete:hover {
    background: #e74c3c;
    color: #fff;
}

.btn-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    flex: 1;
}

.btn-edit:hover {
    background: var(--primary);
    color: #fff;
}

/* Upload Page */
.upload-page {
    max-width: 700px;
}

.recipe-form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.image-upload {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    overflow: hidden;
}

.image-upload:hover,
.image-upload:focus,
.image-upload.dragover {
    border-color: var(--primary);
    background: rgba(230, 126, 34, 0.05);
    outline: none;
}

.image-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-upload-content {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-light);
}

.image-upload-content svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.image-upload-content p {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.image-upload-content span {
    font-size: 0.875rem;
}

.image-preview {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: none;
}

.image-preview.active {
    display: block;
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.btn-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    main {
        padding: 1rem;
    }

    .recipes-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .modal {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-content h2 {
        font-size: 1.5rem;
    }

    .recipe-form {
        padding: 1.5rem;
    }
}

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

.recipe-card {
    animation: fadeIn 0.4s ease forwards;
}

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