/* ===== VARIABLES ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #0891b2;
    --accent-color: #06b6d4;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --success: #10b981;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

/* ===== BASE STYLES ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

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

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: var(--shadow-md);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

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

/* ===== NAVIGATION ===== */
.main-nav {
    background: var(--bg-white);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.main-nav .container > div {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.add-recipe-btn, .back-btn, .print-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

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

.back-btn {
    background: var(--text-light);
}

.back-btn:hover {
    background: var(--text-dark);
}

.search-box {
    flex: 1;
    max-width: 500px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ===== CATEGORY TABS ===== */
.category-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-dark);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
}

.tab-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

/* ===== RECIPE GRID ===== */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.recipe-card {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

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

.recipe-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--border-color) 0%, var(--bg-light) 100%);
}

.recipe-card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.recipe-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.recipe-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--accent-color);
    color: white;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.recipe-meta {
    display: flex;
    gap: 1rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-light);
}

.recipe-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ===== NO RESULTS ===== */
.no-results {
    text-align: center;
    padding: 3rem;
    background: var(--bg-white);
    border-radius: 12px;
    color: var(--text-light);
}

/* ===== RECIPE DETAIL PAGE ===== */
.recipe-detail {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-md);
}

.recipe-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.recipe-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.recipe-detail-image {
    max-width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    border-radius: 12px;
    margin: 2rem auto;
    display: block;
    box-shadow: var(--shadow-md);
}

.recipe-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.info-item {
    text-align: center;
}

.info-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1.25rem;
    color: var(--primary-color);
    font-weight: 700;
}

.recipe-section {
    margin: 2rem 0;
}

.recipe-section h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.ingredients-list {
    list-style: none;
    padding: 0;
}

.ingredients-list li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-light);
    border-radius: 6px;
    border-left: 4px solid var(--accent-color);
}

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

.instructions-list li {
    counter-increment: step-counter;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bg-light);
    border-radius: 6px;
    position: relative;
    padding-left: 4rem;
}

.instructions-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.recipe-notes {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1.5rem;
    border-radius: 6px;
    margin: 2rem 0;
}

.recipe-source {
    text-align: center;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 6px;
    color: var(--text-light);
    font-style: italic;
    margin-top: 2rem;
}

/* ===== ADD RECIPE FORM ===== */
.add-recipe-form {
    max-width: 800px;
    margin: 2rem auto;
}

.form-section {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.form-section h2 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.form-divider {
    text-align: center;
    color: var(--text-light);
    font-weight: 600;
    margin: 2rem 0;
    font-size: 1.1rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.help-text {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.image-preview {
    margin-top: 1rem;
    max-width: 300px;
}

.image-preview img {
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary, .btn-secondary {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

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

.success-message {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 3px solid var(--success);
}

.success-message h3 {
    color: var(--success);
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.success-message button {
    margin: 0.5rem;
}

/* ===== FOOTER ===== */
footer {
    background: var(--text-dark);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* ===== PRINT STYLES ===== */
@media print {
    header, nav, footer, .back-btn, .print-btn, #editBtn {
        display: none;
    }
    
    .recipe-detail {
        box-shadow: none;
        padding: 0;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .recipe-grid {
        grid-template-columns: 1fr;
    }
    
    .category-tabs {
        justify-content: center;
    }
    
    .tab-btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
    
    .main-nav .container {
        flex-direction: column;
    }
    
    .search-box {
        max-width: 100%;
    }
}
