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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1a202c;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
}

header {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-title {
    text-align: center;
    flex: 1;
}

.auth-section {
    display: flex;
    gap: 12px;
    align-items: center;
}

.auth-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.username {
    font-weight: 600;
    color: #667eea;
    padding: 10px 16px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
}

.login-prompt {
    display: flex;
    gap: 10px;
}

.auth-info {
    text-align: center;
    color: #718096;
    margin-bottom: 20px;
}

.error-message {
    color: #e53e3e;
    margin-top: 12px;
    padding: 10px;
    background: rgba(229, 62, 62, 0.1);
    border-radius: 8px;
    display: none;
}

.error-message:not(:empty) {
    display: block;
}

.success-message {
    color: #38a169;
    margin-top: 12px;
    padding: 10px;
    background: rgba(56, 161, 105, 0.1);
    border-radius: 8px;
    display: none;
}

.success-message:not(:empty) {
    display: block;
}

header h1 {
    color: #667eea;
    font-size: 3.5em;
    margin-bottom: 10px;
    font-weight: 800;
    letter-spacing: -1px;
}

header h1 .brand-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: #718096;
    font-size: 1.2em;
    font-weight: 500;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 16px;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-section label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.95em;
}

.filter-section select {
    padding: 12px 20px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    font-size: 1em;
    cursor: pointer;
    background: white;
    font-weight: 500;
    transition: all 0.3s;
}

.filter-section select:hover {
    border-color: #667eea;
}

.filter-section select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(113, 128, 150, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #fc8181 0%, #e53e3e 100%);
    color: white;
    padding: 10px 20px;
    font-size: 0.9em;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(229, 62, 62, 0.4);
}

.btn-edit {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    padding: 10px 20px;
    font-size: 0.9em;
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(49, 130, 206, 0.4);
}

.recipe-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 0 40px;
}

.recipe-list.recipe-list--centered {
    grid-template-columns: unset;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
}

.recipe-card {
    display: block;
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

/* When using flex layout for centering, make cards block-level with fixed width */
.recipe-list[style*="display: flex"] .recipe-card,
.recipe-list[style*="display:flex"] .recipe-card {
    display: block;
    width: 420px;
    max-width: 100%;
    margin-bottom: 0;
}


.recipe-meta {
    color: #718096;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 12px;
}

.recipe-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.2);
}

.recipe-card h3 {
    color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    font-size: 1.6em;
    font-weight: 700;
    line-height: 1.3;
}

.recipe-category {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.85em;
    margin-bottom: 12px;
    text-transform: capitalize;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.recipe-carbs {
    font-weight: 700;
    color: #f56565;
    margin-bottom: 12px;
    font-size: 1.15em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.recipe-description {
    color: #4a5568;
    margin-bottom: 20px;
    line-height: 1.6;
    font-size: 0.95em;
}

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

.recipe-section h4 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 1.1em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.recipe-section ul,
.recipe-section ol {
    padding-left: 24px;
}

.recipe-section li {
    margin-bottom: 6px;
    color: #4a5568;
    line-height: 1.5;
}

.recipe-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.loading {
    text-align: center;
    padding: 60px;
    color: #718096;
    font-size: 1.3em;
    font-weight: 500;
}

.no-recipes {
    text-align: center;
    padding: 60px;
    color: #718096;
    font-size: 1.3em;
    font-weight: 500;
}

/* Network status */
.network-status {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 12px;
    color: #4a5568;
    font-weight: 600;
}
.network-status span {
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.08);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    margin: 3% auto;
    padding: 40px;
    border-radius: 24px;
    width: 90%;
    max-width: 650px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #a0aec0;
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #667eea;
    transform: rotate(90deg);
}

#modalTitle {
    color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 30px;
    font-size: 2em;
    font-weight: 700;
}

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

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    line-height: 1.6;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 24px;
        border-radius: 16px;
    }

    header h1 {
        font-size: 2.5em;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    .recipe-list {
        column-count: 1;
    }

    

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 28px;
    }
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
}
