/* =========================================================================
   Global Layout, Navigation and Component Base Styles
   ========================================================================= */

/* HTML & Body Config */
html {
    scroll-behavior: smooth;
}

body {
    padding-top: 20px;
    padding-bottom: 140px;
    /* Space for floating buttons on mobile and bottom nav */
    min-height: 100vh;
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ===== Typography Additions ===== */
p {
    line-height: 1.6;
}

/* ===== Premium Buttons ===== */
.btn {
    border-radius: var(--radius-pill);
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    transition: all var(--transition-bounce);
    font-family: var(--font-display);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    box-shadow: 0 4px 14px var(--color-primary-alpha);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: 0 6px 20px rgba(31, 122, 82, 0.4);
    transform: translateY(-2px);
}

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

.btn-outline-primary:hover {
    background-color: var(--color-primary);
    color: white;
}

.btn-secondary {
    background-color: var(--color-secondary);
    border-color: var(--color-secondary);
    color: white;
    box-shadow: 0 4px 14px var(--color-secondary-alpha);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--color-secondary-dark);
    border-color: var(--color-secondary-dark);
    box-shadow: 0 6px 20px rgba(212, 99, 60, 0.4);
    transform: translateY(-2px);
}

.btn-ia {
    background: linear-gradient(135deg, rgba(131, 58, 180, 1) 0%, rgba(253, 29, 29, 1) 50%, rgba(252, 176, 69, 1) 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(253, 29, 29, 0.3);
}

.btn-ia:hover {
    background: linear-gradient(135deg, rgba(82, 24, 119, 1) 0%, rgba(214, 14, 14, 1) 50%, rgba(230, 147, 27, 1) 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(253, 29, 29, 0.4);
}

.fab-container {
    position: fixed;
    bottom: 110px;
    right: 24px;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-fab {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-float);
    padding: 0;
}

/* ===== Inputs and Forms ===== */
.form-control,
.form-select {
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    background-color: var(--color-surface);
    transition: all var(--transition-smooth);
    color: var(--color-text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 4px var(--color-primary-alpha);
}

.input-group-text {
    border-radius: var(--radius-md);
    background-color: var(--color-bg);
    border-color: var(--color-border);
    color: var(--color-text-muted);
}

/* Removes blue outline completely on iOS safari */
input,
textarea,
select,
button {
    -webkit-tap-highlight-color: transparent;
}

/* ===== Cards General ===== */
.card-ease {
    background: var(--color-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-smooth);
    overflow: hidden;
}

.card-ease:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.btn-del-recipe {
    border: none;
    background: none;
    font-size: 1.1rem;
    color: var(--color-border-hover);
    cursor: pointer;
    padding: 0.35rem;
    transition: all var(--transition-fast);
    opacity: 0.5;
}

.btn-del-recipe:hover {
    color: var(--color-danger, #dc3545);
    transform: scale(1.15);
    opacity: 1;
}

/* ===== Bottom Navigation Bar ===== */
.bottom-nav {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background-color: rgba(255, 255, 255, 0.85);
    /* Glassmorphism background */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 1040;
    /* Sit above content, below modals */
    padding: 0.25rem 0.5rem;
}

.bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    margin: 0 auto;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.5rem;
    transition: all var(--transition-fast);
    flex: 1;
}

.bottom-nav-item i {
    font-size: 1.35rem;
    margin-bottom: 2px;
    transition: transform var(--transition-bounce), color var(--transition-fast);
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: var(--color-primary);
}

.bottom-nav-item.active i {
    transform: translateY(-2px);
    color: var(--color-primary);
}

.bottom-nav-item.text-danger:hover {
    color: #dc3545 !important;
}

.bottom-nav-item.text-danger:hover i {
    color: #dc3545 !important;
}

/* More button (cursor) */
.bottom-nav-more {
    cursor: pointer;
}

/* ===== Nav More Menu ===== */
.nav-more-overlay {
    position: fixed;
    inset: 0;
    z-index: 1039;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.nav-more-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.nav-more-menu {
    position: fixed;
    bottom: 5.5rem;
    right: 50%;
    transform: translateX(50%) translateY(10px);
    width: auto;
    min-width: 180px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    z-index: 1041;
    padding: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-more-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(50%) translateY(0);
}

.nav-more-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    text-decoration: none;
    color: var(--color-text);
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-more-item:hover {
    background: var(--color-primary-alpha);
    color: var(--color-primary);
}

.nav-more-item.active {
    color: var(--color-primary);
    font-weight: 700;
}

.nav-more-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-up {
    animation: fadeInUp 0.5s var(--transition-bounce) both;
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

/* AI Spinner and Glow */
.ia-glow {
    position: relative;
    overflow: hidden;
}

.ia-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: rotate(30deg);
    animation: shimmer 2s infinite linear;
}

@keyframes shimmer {
    from {
        transform: translateX(-100%) rotate(30deg);
    }

    to {
        transform: translateX(100%) rotate(30deg);
    }
}

/* ===== Loading Overlay Global ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ===== Modals (Premium Look) ===== */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.modal-header {
    border-bottom: 1px solid var(--color-border);
    padding: 1.5rem;
}

.modal-footer {
    border-top: none;
}

/* =========================================================================
   Mobile Responsiveness (Added in V2)
   ========================================================================= */
@media (max-width: 767px) {
    body {
        padding-top: 15px;
        padding-bottom: 140px;
    }

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .fab-container {
        bottom: 110px;
        right: 16px;
    }

    .btn-fab {
        width: 52px;
        height: 52px;
        font-size: 1.2rem;
    }
}