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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0rem;
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    color: #2c3e50;
    font-size: 2rem;
}

.back-link {
    color: #3498db;
    text-decoration: none;
    font-size: 1rem;
}

.back-link:hover {
    text-decoration: underline;
}

.recipe-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background-color: rgba(245, 245, 245, 0.97);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid #e0e0e0;
}

.recipe-topbar .container {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.recipe-editor-content {
    padding-top: calc(2rem + 80px);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-primary {
    background-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
}

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

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

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

.recipe-card {
    display: block;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.recipe-card h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    color: #2c3e50;
}

.recipe-card:hover h2 {
    color: #3498db;
}

.recipe-card .description {
    color: #7f8c8d;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.recipe-preview {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    max-height: 9.6em; /* ~6 lines at 1.6 line-height */
    min-height: 9.6em; /* ensure fade starts below 6th line */
    overflow: hidden;
    position: relative;
}

.recipe-preview p {
    margin: 0;
}

.recipe-preview::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.5em;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.9));
}

.recipe-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #7f8c8d;
    font-size: 1.1rem;
}

.empty-state a {
    color: #3498db;
    text-decoration: none;
}

.empty-state a:hover {
    text-decoration: underline;
}

.recipe-view {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.recipe-view h1 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

.recipe-view .description {
    color: #7f8c8d;
    font-size: 1.1rem;
    margin-bottom: 2rem;
    font-style: italic;
}

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

.recipe-section h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
}

.content-box {
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 4px;
    line-height: 1.8;
}

.content-box p {
    margin-bottom: 0.5rem;
}

.form-container {
    background: white;
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    margin: 0 auto;
}

.form-container h1 {
    color: #2c3e50;
    margin-bottom: 2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.form-group input[readonly],
.form-group textarea[readonly] {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
    border-color: #ccc;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #7f8c8d;
    font-size: 0.9rem;
}

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

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: #e8f4f8;
    color: #2c3e50;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.recipe-view .tags {
    margin-bottom: 1.5rem;
}

.recipe-view .tag {
    background-color: #3498db;
    color: white;
}

.login-options {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.login-option {
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}

.login-option h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.login-description {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-form {
    margin-top: 1rem;
}

.login-form .btn {
    width: 100%;
}

/* Menu FAB and wrapper: hidden on desktop, shown only on mobile */
.menu-fab-wrapper {
    display: none;
}

.menu-fab {
    display: none;
    border: none;
    cursor: pointer;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

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

    header {
        flex-direction: row;
        align-items: flex-start;
    }

    .header-user-section {
        display: none;
    }

    .recipe-editor-content {
        padding-top: calc(1rem + 80px);
    }

    /* Menu FAB wrapper: only groups panel + button for JS; no positioning */
    .menu-fab-wrapper {
        display: block;
    }

    .mobile-menu-panel {
        position: fixed;
        bottom: calc(1.5rem + 56px + 0.5rem);
        left: 1.5rem;
        z-index: 801;
        visibility: hidden;
        opacity: 0;
        transform: translateY(0.5rem);
        transition: visibility 0.2s, opacity 0.2s, transform 0.2s;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        min-width: 200px;
    }

    .menu-fab-wrapper.is-open .mobile-menu-panel {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
    }

    .mobile-menu-item {
        display: block;
        width: 100%;
        padding: 0.75rem 1rem;
        text-align: left;
        font-size: 1rem;
        color: white;
        background: #3498db;
        border: none;
        border-radius: 999px;
        box-shadow: 0 3px 10px rgba(52, 152, 219, 0.4);
        cursor: pointer;
        text-decoration: none;
        font-family: inherit;
        transition: box-shadow 0.2s, background-color 0.2s;
    }

    .mobile-menu-item:hover {
        background-color: #2980b9;
        box-shadow: 0 4px 14px rgba(52, 152, 219, 0.5);
    }

    .mobile-menu-user-email {
        color: rgba(255, 255, 255, 0.95);
        font-size: 0.9rem;
    }

    .mobile-menu-action {
        color: white;
    }

    .mobile-menu-link {
        color: white;
    }

    /* Menu FAB: fixed circle bottom-left on mobile (same position as before) */
    .menu-fab {
        position: fixed;
        bottom: 1.5rem;
        left: 1.5rem;
        z-index: 800;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 50%;
        background-color: #7f8c8d;
        color: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        transition: background-color 0.2s;
    }

    .menu-fab:hover {
        background-color: #95a5a6;
    }

    .menu-fab-line {
        display: block;
        width: 22px;
        height: 2px;
        background-color: currentColor;
        border-radius: 1px;
    }

    /* Create FAB: fixed circle bottom-right on mobile */
    .create-btn {
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.75rem;
        line-height: 1;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        z-index: 800;
    }

    .create-btn .create-btn-label {
        display: none;
    }
}

/* 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.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5rem;
}

.modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover,
.modal-close:focus {
    color: #000;
}

.modal-content .form-group,
.modal-content .form-actions {
    padding: 0 1.5rem;
}

.modal-content .form-actions {
    padding-bottom: 1.5rem;
    margin-top: 1.5rem;
}


