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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #F5E6D3;
    background-image: 
        /* Parchment texture */
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(139, 90, 43, 0.03) 2px, rgba(139, 90, 43, 0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(139, 90, 43, 0.03) 2px, rgba(139, 90, 43, 0.03) 4px),
        /* Subtle food illustrations using CSS patterns */
        radial-gradient(circle at 15% 20%, rgba(255, 182, 39, 0.08) 0%, transparent 15%),
        radial-gradient(circle at 85% 30%, rgba(255, 107, 53, 0.08) 0%, transparent 15%),
        radial-gradient(circle at 50% 80%, rgba(255, 152, 0, 0.08) 0%, transparent 15%),
        radial-gradient(circle at 25% 70%, rgba(230, 126, 34, 0.06) 0%, transparent 12%),
        radial-gradient(circle at 75% 15%, rgba(241, 196, 15, 0.06) 0%, transparent 12%),
        /* Base parchment color */
        linear-gradient(135deg, #F5E6D3 0%, #FDF5E6 50%, #F5E6D3 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: #3D2817;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        /* Decorative food elements using Unicode/patterns */
        url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 50 Q30 40 40 50 Q50 60 60 50' stroke='rgba(139,90,43,0.1)' fill='none' stroke-width='1'/%3E%3Cpath d='M70 30 Q75 25 80 30 Q85 35 90 30' stroke='rgba(139,90,43,0.1)' fill='none' stroke-width='1'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg width='80' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='40' cy='40' r='15' stroke='rgba(139,90,43,0.08)' fill='none' stroke-width='1'/%3E%3Cpath d='M40 25 L40 55 M25 40 L55 40' stroke='rgba(139,90,43,0.08)' stroke-width='1'/%3E%3C/svg%3E");
    background-size: 200px 200px, 150px 150px;
    background-position: 10% 10%, 90% 90%;
    background-repeat: repeat;
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        /* Subtle cutlery and food decorative patterns */
        url("data:image/svg+xml,%3Csvg width='120' height='120' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M60 20 L60 80 M50 30 L70 30' stroke='rgba(139,90,43,0.12)' fill='none' stroke-width='1.5'/%3E%3Cpath d='M30 50 Q40 45 50 50 Q60 55 70 50' stroke='rgba(139,90,43,0.1)' fill='none' stroke-width='1'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cellipse cx='50' cy='50' rx='20' ry='15' stroke='rgba(139,90,43,0.1)' fill='none' stroke-width='1'/%3E%3Cpath d='M50 35 L50 65 M35 50 L65 50' stroke='rgba(139,90,43,0.1)' stroke-width='1'/%3E%3C/svg%3E");
    background-size: 300px 300px, 250px 250px;
    background-position: 5% 5%, 95% 95%;
    background-repeat: repeat;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    color: #3D2817;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: rgba(255, 248, 231, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(61, 40, 23, 0.15);
    border: 2px solid rgba(139, 90, 43, 0.2);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 182, 39, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

header h1 {
    font-size: 3.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(139, 90, 43, 0.3);
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #8B5A3C 0%, #D2691E 50%, #8B5A3C 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.3em;
    color: #5C4033;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(255, 248, 231, 0.8);
    position: relative;
    z-index: 1;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 14px 20px;
    border: 2px solid rgba(139, 90, 43, 0.3);
    border-radius: 12px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(61, 40, 23, 0.1);
    background: rgba(255, 248, 231, 0.95);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    color: #3D2817;
}

.search-input:focus {
    outline: none;
    border-color: #D2691E;
    box-shadow: 0 4px 20px rgba(210, 105, 30, 0.3);
    background: rgba(255, 248, 231, 1);
}

.search-input::placeholder {
    color: #999;
}

.actions {
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #E55A2B 0%, #E0841A 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #FFB627 0%, #FFA500 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 182, 39, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #E5A523 0%, #E59500 100%);
    box-shadow: 0 6px 20px rgba(255, 182, 39, 0.5);
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-edit {
    background: linear-gradient(135deg, #FFB627 0%, #FF9800 100%);
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(255, 182, 39, 0.3);
    border: none;
}

.btn-edit:hover {
    background: linear-gradient(135deg, #E5A523 0%, #E68900 100%);
    box-shadow: 0 4px 12px rgba(255, 182, 39, 0.4);
    transform: translateY(-1px);
}

.btn-delete {
    background: linear-gradient(135deg, #E63946 0%, #C41E3A 100%);
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
    border: none;
}

.btn-delete:hover {
    background: linear-gradient(135deg, #D12E3D 0%, #B11A2F 100%);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
    transform: translateY(-1px);
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    padding: 15px;
    background: rgba(255, 248, 231, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(61, 40, 23, 0.1);
    border: 2px solid rgba(139, 90, 43, 0.2);
}

.category-filter-btn {
    padding: 10px 20px;
    border: 2px solid rgba(139, 90, 43, 0.3);
    border-radius: 8px;
    background: rgba(255, 248, 231, 0.9);
    color: #5C4033;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.category-filter-btn:hover {
    background: rgba(139, 90, 43, 0.15);
    border-color: rgba(139, 90, 43, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(61, 40, 23, 0.2);
}

.category-filter-btn.active {
    background: rgba(139, 69, 19, 0.85);
    color: #F5E6D3;
    border-color: rgba(139, 69, 19, 0.9);
    box-shadow: 0 2px 6px rgba(139, 69, 19, 0.3);
}

.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.recipe-card {
    background: rgba(255, 248, 231, 0.95);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(61, 40, 23, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid rgba(139, 90, 43, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    user-select: none;
}

.recipe-card * {
    pointer-events: none;
}

.recipe-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 248, 231, 0.1) 0%, transparent 100%);
    pointer-events: none;
    border-radius: 16px;
}

.recipe-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 35px rgba(139, 90, 43, 0.25);
    border-color: rgba(210, 105, 30, 0.4);
}

.recipe-image-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
}

.recipe-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #FFF8E7 0%, #FFE5CC 100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.recipe-image:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.recipe-category-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(139, 69, 19, 0.85);
    color: #F5E6D3;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.recipe-creator-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(30, 58, 138, 0.85);
    color: #F5E6D3;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.recipe-creator-badge-no-image {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(30, 58, 138, 0.85);
    color: #F5E6D3;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.recipe-checked-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(34, 139, 34, 0.9);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 10;
}

.recipe-checked-badge-no-image {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(34, 139, 34, 0.9);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 10;
}

.recipe-unchecked-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 20, 60, 0.9);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 10;
}

.recipe-unchecked-badge-no-image {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 20, 60, 0.9);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 10;
}

.recipe-content {
    padding: 15px;
}

.recipe-title {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 8px;
    color: #3D2817;
    line-height: 1.3;
    text-align: center;
}

.recipe-preview {
    color: #5C4033;
    font-size: 0.95em;
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
}

.recipe-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.loading {
    text-align: center;
    color: #5C4033;
    font-size: 1.3em;
    padding: 50px;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(255, 248, 231, 0.8);
}

.empty-state {
    text-align: center;
    color: #5C4033;
    font-size: 1.3em;
    padding: 50px;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(255, 248, 231, 0.8);
    background: rgba(255, 248, 231, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 2px solid rgba(139, 90, 43, 0.2);
    box-shadow: 0 4px 15px rgba(61, 40, 23, 0.1);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(61, 40, 23, 0.75);
    backdrop-filter: blur(5px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Recipe detail modal - non-translucent parchment background */
#recipeModal {
    background-color: #F5E6D3;
    background-image: 
        /* Parchment texture */
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(139, 90, 43, 0.03) 2px, rgba(139, 90, 43, 0.03) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(139, 90, 43, 0.03) 2px, rgba(139, 90, 43, 0.03) 4px),
        /* Subtle food illustrations */
        radial-gradient(circle at 15% 20%, rgba(255, 182, 39, 0.08) 0%, transparent 15%),
        radial-gradient(circle at 85% 30%, rgba(255, 107, 53, 0.08) 0%, transparent 15%),
        radial-gradient(circle at 50% 80%, rgba(255, 152, 0, 0.08) 0%, transparent 15%),
        radial-gradient(circle at 25% 70%, rgba(230, 126, 34, 0.06) 0%, transparent 12%),
        radial-gradient(circle at 75% 15%, rgba(241, 196, 15, 0.06) 0%, transparent 12%),
        /* Base parchment color */
        linear-gradient(135deg, #F5E6D3 0%, #FDF5E6 50%, #F5E6D3 100%);
    backdrop-filter: none;
    outline: none;
}

#recipeModal:focus {
    outline: none;
}

.modal-content {
    background: linear-gradient(135deg, #FFF8E7 0%, #FDF5E6 100%);
    margin: 5% auto;
    padding: 35px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(61, 40, 23, 0.3);
    position: relative;
    border: 2px solid rgba(139, 90, 43, 0.3);
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(139, 90, 43, 0.02) 2px, rgba(139, 90, 43, 0.02) 4px);
}

.modal-content.large {
    max-width: 1200px;
}

#editModal .modal-content {
    max-width: 984px;
}

/* Recipe modal content - match parchment background */
#recipeModal .modal-content {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 40px;
    max-height: none;
    overflow: visible;
    outline: none;
}

/* Ensure recipe modal allows page scrolling and keyboard navigation */
#recipeModal {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    outline: none;
}

#recipeModal .modal-content:focus {
    outline: none;
}

.close {
    color: #8B5A3C;
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(139, 90, 43, 0.1);
}

.close:hover,
.close:focus {
    color: #5C4033;
    background: rgba(139, 90, 43, 0.2);
    transform: rotate(90deg);
}

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

.modal-content h2 {
    color: #3D2817;
    margin-bottom: 25px;
    font-size: 2em;
    font-weight: 700;
    border-bottom: 3px solid #FF6B35;
    padding-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #5C4033;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #E0D5C7;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
    background: white;
}

#recipeDetail {
    padding: 20px 0;
}

.recipe-detail-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}

.recipe-detail-title {
    font-size: 2.5em;
    margin-bottom: 12px;
    color: #3D2817;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.recipe-detail-description {
    text-align: center;
    color: #5C4033;
    font-size: 24px;
    font-weight: bold;
    font-family: "Century Gothic", CenturyGothic, sans-serif;
    margin-bottom: 20px;
    line-height: 1.4;
    background: transparent;
    padding-left: 0;
    border-left: none;
}

.recipe-detail-content {
    font-size: 1em;
    line-height: 1.5;
    color: #5C4033;
    background: transparent;
    padding: 15px;
    border-radius: 12px;
    border-left: none;
}

.recipe-detail-content p {
    margin-bottom: 1em;
}

.recipe-detail-content ul,
.recipe-detail-content ol {
    margin-left: 20px;
    margin-bottom: 1em;
}

.recipe-detail-content h1,
.recipe-detail-content h2,
.recipe-detail-content h3 {
    color: #3D2817;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.recipe-detail-content strong,
.recipe-detail-content b {
    font-weight: 700;
    color: #3D2817;
}

.recipe-detail-content em,
.recipe-detail-content i {
    font-style: italic;
}

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

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

.recipe-section-header {
    font-weight: bold;
    font-size: 1.2em;
    color: #3D2817;
    margin-top: 12px;
    margin-bottom: 6px;
}

.recipe-section-header:first-of-type {
    margin-top: 0;
}

.recipe-section > div:not(.recipe-section-header) {
    margin-bottom: 4px;
}

.recipe-instructions {
    margin: 0;
    padding: 0;
    list-style-position: inside;
}

.recipe-instructions li {
    margin: 0;
    padding: 0;
    line-height: 1.5;
    margin-bottom: 0;
}

.error-message {
    background: linear-gradient(135deg, #FFE5E5 0%, #FFCCCC 100%);
    color: #C41E3A;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #E63946;
    box-shadow: 0 2px 8px rgba(230, 57, 70, 0.2);
    font-weight: 500;
}

.success-message {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    color: #2E7D32;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #4CAF50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
    font-weight: 500;
}

@media (max-width: 768px) {
    .recipes-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

