/* ==========================================================================
   Bloxlift — Components
   Reusable UI: buttons, header, loaders, footer.
   ========================================================================== */

/* --------------------------------------------------------------------------
   3. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease),
        transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
    text-decoration: none;
    border: none;
    white-space: nowrap;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

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

.btn-block {
    justify-content: center;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease),
        background-color 0.2s var(--ease), transform 0.15s var(--ease);
}

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

/* Danger variant of the outline button (e.g. "Delete account"), mirroring
   the app's red-outlined destructive action. */
.btn-outline-danger,
.btn-outline-danger:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger-soft);
}

/* --------------------------------------------------------------------------
   4. Site header (shared across all pages)
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-header-inner {
    max-width: var(--container);
    margin: 0 auto;
    height: var(--header-h);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.brand {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.2s var(--ease);
}

.brand span {
    color: var(--primary);
}

.brand:hover {
    opacity: 0.8;
}

.header-search {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 420px;
    min-width: 0;
    margin: 0 auto; /* centered between brand and actions */
}

.header-search i {
    position: absolute;
    left: 1rem;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    pointer-events: none;
}

.header-search input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    background: var(--surface);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.header-search input::placeholder {
    color: var(--text-tertiary);
}

.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
    flex-shrink: 0;
}

.header-search + .header-actions {
    margin-left: 0;
}

.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.header-icon-btn:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.header-icon-btn i {
    font-size: 1.2rem;
}

.header-icon-img {
    width: 1.1rem;
    height: 1.1rem;
}

/* Header icon whose hover only tints the icon — no circle background. */
.header-icon-plain:hover {
    background: transparent;
}

/* Compact pill variant of .btn for the header ("Log in"). */
.header-login-btn {
    padding: 0.5rem 1.15rem;
    font-size: 0.9rem;
    border-radius: var(--radius-full);
}

/* Icon rendered as a CSS mask so it tints with `color` (hover) like the
   inline SVGs, without embedding the artwork in every page. */
.header-icon-mask {
    width: 1.35rem;
    height: 1.35rem;
    background-color: currentColor;
    -webkit-mask: url('/assets/Black-Icon.svg') no-repeat center / contain;
    mask: url('/assets/Black-Icon.svg') no-repeat center / contain;
}

/* --------------------------------------------------------------------------
   10. Loaders & empty states
   -------------------------------------------------------------------------- */
.loader-container,
.empty-state {
    text-align: center;
    padding: 4rem 0;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-strong);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    margin: 0 auto 1rem;
    animation: spin 0.8s linear infinite;
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* --------------------------------------------------------------------------
   11. Footer (shared across all pages)
   -------------------------------------------------------------------------- */
.footer {
    margin-top: auto;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 3rem 1.5rem 2rem;
}

.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.4fr;
    gap: 2.5rem;
    padding-bottom: 2.5rem;
}

.footer-brand .brand {
    font-size: 1.3rem;
}

.footer-tagline {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 260px;
    line-height: 1.55;
}

.footer-social {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
        background-color 0.2s var(--ease);
}

.footer-social a:hover {
    color: var(--primary);
    border-color: var(--primary-ring);
    background: var(--primary-soft);
}

/* App store badges: plain image links, not the 36px icon circles. Both
   SVGs are padding-free, so a shared fixed height keeps them uniform. */
.footer-social a.footer-store,
.footer-social a.footer-store:hover {
    width: auto;
    height: auto;
    border: none;
    border-radius: 0;
    background: none;
}

.footer-store-badge {
    height: 38px;
    width: auto;
    display: block;
}

/* App Store badge stays in the markup but hidden until the iOS app ships —
   remove this class from the anchors (or this rule) to show it again. */
.footer-social a.footer-store-hidden {
    display: none;
}

.footer-social .header-icon-img {
    width: 0.95rem;
    height: 0.95rem;
}

.footer-col h4 {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 0.9rem;
}

.footer-col a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
    transition: color 0.2s var(--ease);
    word-break: break-word;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-col a i {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
}

.footer-disclaimer {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    line-height: 1.5;
    max-width: 560px;
    margin: 0;
}

.footer-copyright {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    margin: 0;
}

/* --------------------------------------------------------------------------
   Responsive — header & footer
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .site-header-inner {
        gap: 0.75rem;
        padding: 0 1rem;
    }

    .brand {
        font-size: 1.25rem;
    }

    .header-search i {
        left: 0.8rem;
        font-size: 0.8rem;
    }

    .header-search input {
        padding: 0.5rem 0.75rem 0.5rem 2.1rem;
        font-size: 0.9rem;
    }

    .header-actions {
        gap: 0;
    }

    .header-icon-btn {
        width: 36px;
        height: 36px;
    }

    .header-icon-btn i {
        font-size: 1.05rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 0.75rem;
    }

    .footer-copyright {
        white-space: normal;
    }
}

@media (max-width: 520px) {
    .footer-top {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
}

/* --------------------------------------------------------------------------
   Modals (login, edit profile, confirmations)
   -------------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(28, 27, 31, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* `display: flex` above would otherwise override the UA rule for [hidden]. */
.modal-backdrop[hidden] {
    display: none;
}

.modal-divider {
    border-top: 1px solid var(--border);
    margin: 20px 0 14px;
}

.modal-link-danger {
    color: var(--danger);
}

.modal {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    padding: 28px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-tertiary);
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.modal-sub {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 18px;
}

.modal-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 12px 0 6px;
}

.modal-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.modal-input-code {
    letter-spacing: 0.4em;
    font-weight: 700;
    text-align: center;
}

.modal-error {
    font-size: 0.85rem;
    color: var(--danger);
    margin: 10px 0 0;
}

.modal .btn-block {
    width: 100%;
    margin-top: 16px;
}

.modal-links {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
}

.modal-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    padding: 2px;
}

.modal-link:disabled {
    color: var(--text-tertiary);
    cursor: default;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

.btn-danger {
    background-color: var(--danger);
}

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