/**
 * LEJEDX — unified rectangular button system (v3).
 * Loaded last on every layout so it wins over page-specific CSS.
 */

/* ---- Design tokens -------------------------------------------------- */
:root {
    --btn-radius: 0;
    --btn-spring: cubic-bezier(0.22, 1, 0.36, 1);
    --btn-primary-bg: linear-gradient(135deg, #3b82f6 0%, #2563eb 52%, #1d4ed8 100%);
    --btn-primary-bg-hover: linear-gradient(135deg, #2563eb 0%, #1d4ed8 52%, #1e3a8a 100%);
    --btn-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
    --btn-shadow-hover: 0 14px 36px rgba(37, 99, 235, 0.42);
}

/* ---- Shared base (every clickable CTA) ------------------------------ */
.btn,
.premium-core-button,
.premium-project-button,
.premium-project-button-page,
.sidebar-btn,
.filter-btn,
.btn-professional,
button.auth-submit,
a.auth-submit,
.qa-maint-run,
.qa-user-active-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--btn-radius) !important;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    transition:
        transform 0.35s var(--btn-spring),
        box-shadow 0.35s var(--btn-spring),
        background 0.35s var(--btn-spring),
        border-color 0.35s var(--btn-spring),
        color 0.35s var(--btn-spring);
}

.btn {
    border-width: 1.5px;
}

/* Subtle shine sweep on primary-style buttons */
.btn-primary::after,
.premium-core-button::after,
.premium-project-button::after,
.premium-project-button-page::after,
.sidebar-btn:not(.sidebar-btn-outline)::after,
.btn-professional::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.22) 50%,
        transparent 60%
    );
    transform: translateX(-120%);
    transition: transform 0.55s var(--btn-spring);
    pointer-events: none;
    z-index: 0;
}

.btn-primary:hover::after,
.premium-core-button:hover::after,
.premium-project-button:hover::after,
.premium-project-card:hover .premium-project-button::after,
.premium-project-card-page:hover .premium-project-button-page::after,
.sidebar-btn:not(.sidebar-btn-outline):hover::after,
.btn-professional:hover::after {
    transform: translateX(120%);
}

.btn > *,
.premium-core-button > *:not(.core-svc-btn-shimmer),
.premium-project-button > *,
.premium-project-button-page > * {
    position: relative;
    z-index: 1;
}

/* ---- Sizes ---------------------------------------------------------- */
.btn-sm,
.qa-maint-run,
.qa-user-active-toggle {
    padding: 0.5rem 1.15rem;
    font-size: 0.875rem;
    min-height: 38px;
}

.btn-lg {
    padding: 0.92rem 2.15rem;
    font-size: 1rem;
    min-height: 52px;
    gap: 0.6rem;
}

.btn-xl {
    padding: 1rem 2.4rem;
    font-size: 1.0625rem;
    min-height: 56px;
}

/* ---- Primary -------------------------------------------------------- */
.btn-primary,
.premium-core-button,
.premium-project-button,
.premium-project-button-page,
.sidebar-btn:not(.sidebar-btn-outline),
.btn-professional,
.qa-maint-run {
    background: var(--btn-primary-bg) !important;
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.22) !important;
    box-shadow: var(--btn-shadow);
}

.btn-primary:hover,
.premium-core-button:hover,
.premium-project-button:hover,
.premium-project-card:hover .premium-project-button,
.premium-project-card-page:hover .premium-project-button-page,
.sidebar-btn:not(.sidebar-btn-outline):hover,
.btn-professional:hover,
.qa-maint-run:hover {
    background: var(--btn-primary-bg-hover) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    box-shadow: var(--btn-shadow-hover);
    transform: translateY(-3px);
}

.btn-primary:active,
.premium-core-button:active,
.premium-project-button:active,
.sidebar-btn:active,
.btn-professional:active,
.qa-maint-run:active {
    transform: translateY(-1px) scale(0.98);
}

/* ---- Secondary / success / error ------------------------------------ */
.btn-secondary,
.btn-success,
.qa-user-active-toggle.btn-secondary {
    background: linear-gradient(135deg, #10b981 0%, #059669 55%, #047857 100%) !important;
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.28);
}

.btn-secondary:hover,
.btn-success:hover,
.qa-user-active-toggle.btn-secondary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 12px 30px rgba(5, 150, 105, 0.38);
    transform: translateY(-3px);
}

.btn-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 55%, #b91c1c 100%) !important;
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.28);
}

.btn-error:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    transform: translateY(-3px);
}

/* ---- Outline -------------------------------------------------------- */
.btn-outline,
.sidebar-btn-outline {
    background: rgba(255, 255, 255, 0.78) !important;
    color: var(--primary-700, #1d4ed8) !important;
    border: 1.5px solid rgba(37, 99, 235, 0.32) !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.btn-outline:hover,
.sidebar-btn-outline:hover {
    background: var(--btn-primary-bg) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: var(--btn-shadow-hover);
    transform: translateY(-3px);
}

/* ---- Light (coloured sections) -------------------------------------- */
.btn-light {
    background: rgba(255, 255, 255, 0.96) !important;
    color: var(--primary-700, #1d4ed8) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.65) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.btn-light:hover {
    background: #ffffff !important;
    color: var(--primary-800, #1e40af) !important;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
    transform: translateY(-3px);
}

/* ---- Ghost ------------------------------------------------------------ */
.btn-ghost {
    background: rgba(37, 99, 235, 0.07) !important;
    color: var(--primary-700, #1d4ed8) !important;
    border: 1.5px solid transparent !important;
}

.btn-ghost:hover {
    background: rgba(37, 99, 235, 0.14) !important;
    transform: translateY(-2px);
}

/* ---- Card-embedded project buttons ---------------------------------- */
.premium-project-button,
.premium-project-button-page {
    padding: 0.8rem 1.5rem;
    font-size: 0.9375rem;
    align-self: flex-start;
    margin-top: auto;
}

/* Desktop / laptop (true hover): reveal "View Project" only on card hover.
   Touch / coarse pointers keep the button always visible. */
@media (hover: hover) and (pointer: fine) {
    .premium-project-button,
    .premium-project-button-page {
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        pointer-events: none;
        transition:
            opacity 0.3s var(--btn-spring),
            visibility 0.3s var(--btn-spring),
            transform 0.3s var(--btn-spring),
            background 0.3s var(--btn-spring),
            box-shadow 0.3s var(--btn-spring),
            border-color 0.3s var(--btn-spring);
    }

    .premium-project-card:hover .premium-project-button,
    .premium-project-card:focus-within .premium-project-button,
    .premium-project-card-page:hover .premium-project-button-page,
    .premium-project-card-page:focus-within .premium-project-button-page {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }
}

.premium-core-button {
    padding: 0.82rem 1.65rem;
    font-size: 0.9375rem;
    align-self: flex-start;
}

.sidebar-btn {
    width: 100%;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

/* ---- Filter buttons ------------------------------------------------- */
.filter-btn {
    padding: 0.65rem 1.45rem;
    font-size: 0.8125rem;
    background: rgba(255, 255, 255, 0.92) !important;
    color: var(--text-secondary, #4b5563) !important;
    border: 1.5px solid rgba(37, 99, 235, 0.16) !important;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--btn-primary-bg) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 10px 26px rgba(37, 99, 235, 0.32);
    transform: translateY(-2px);
}

/* ---- Form helpers --------------------------------------------------- */
.country-code-button {
    border-radius: var(--btn-radius) !important;
    border: 1.5px solid rgba(37, 99, 235, 0.2) !important;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1rem;
    font-weight: 600;
    transition: all 0.3s var(--btn-spring);
}

.country-code-button:hover,
.country-code-button.active {
    border-color: rgba(37, 99, 235, 0.45) !important;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

/* Newsletter button — keep rectangular; layout in style.css */
.footer-premium .newsletter-btn {
    border-radius: 0 !important;
}

.footer-premium .newsletter-btn:hover {
    transform: none;
}

.auth-link-btn {
    border-radius: var(--btn-radius);
    padding: 0.3rem 0.7rem;
    font-weight: 600;
    transition: background 0.25s ease, color 0.25s ease;
}

.auth-link-btn:hover {
    background: rgba(37, 99, 235, 0.1);
}

/* ---- Floating action buttons ---------------------------------------- */
.whatsapp-float {
    border-radius: 50% !important;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45);
    transition: transform 0.35s var(--btn-spring), box-shadow 0.35s var(--btn-spring);
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(37, 211, 102, 0.55);
}

.back-to-top {
    border-radius: 50% !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.28);
    transition: transform 0.35s var(--btn-spring), box-shadow 0.35s var(--btn-spring);
}

.back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.38);
}

/* ---- Icon nudge ----------------------------------------------------- */
.btn i,
.premium-core-button i,
.premium-project-button i,
.premium-project-button-page i,
.sidebar-btn i {
    transition: transform 0.35s var(--btn-spring);
}

.btn:hover i,
.premium-core-button:hover i,
.premium-project-button:hover i,
.premium-project-card:hover .premium-project-button i,
.premium-project-card-page:hover .premium-project-button-page i,
.sidebar-btn:hover i {
    transform: translateX(4px);
}

/* ---- Focus & disabled ----------------------------------------------- */
.btn:focus-visible,
.premium-core-button:focus-visible,
.sidebar-btn:focus-visible,
.filter-btn:focus-visible {
    outline: 2px solid var(--primary-500, #3b82f6);
    outline-offset: 3px;
}

.btn:disabled,
.btn[disabled],
button:disabled.btn,
button:disabled.auth-submit {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ---- Layout helpers ------------------------------------------------- */
.clean-hero-section .hero-cta .btn,
.project-cta-buttons .sidebar-btn {
    min-width: 180px;
}

.clean-hero-section .hero-cta .btn {
    min-width: 11.5rem;
    padding: 0.95rem 1.65rem;
    font-size: 0.8125rem;
    box-shadow: none;
}

.clean-hero-section .hero-cta .btn-primary {
    border: 1.5px solid transparent !important;
}

.clean-hero-section .hero-cta .btn-primary:hover {
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35);
    transform: translateY(-2px);
}

/* Ghost secondary on dark hero backgrounds */
.clean-hero-section .hero-cta .btn-hero-secondary,
.btn-hero-secondary {
    background: transparent !important;
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.9) !important;
    box-shadow: none !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.clean-hero-section .hero-cta .btn-hero-secondary:hover,
.btn-hero-secondary:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
    box-shadow: none !important;
    transform: translateY(-2px);
}

.clean-hero-section .btn-hero-secondary::after,
.clean-hero-section .hero-cta .btn-primary::after,
.btn-hero-secondary::after {
    display: none;
}

.contact-form-card .btn,
.auth-submit {
    width: 100%;
    justify-content: center;
}

.featured-projects-cta {
    text-align: center;
    margin-top: 2.5rem;
}

@media (max-width: 768px) {
    .clean-hero-section .hero-cta .btn,
    .project-cta-buttons .sidebar-btn {
        min-width: 0;
        width: 100%;
        max-width: 320px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn,
    .premium-core-button,
    .premium-project-button,
    .premium-project-button-page,
    .sidebar-btn,
    .filter-btn,
    .whatsapp-float,
    .back-to-top {
        transition: none;
    }

    .btn-primary::after,
    .premium-core-button::after,
    .premium-project-button::after,
    .premium-project-button-page::after {
        display: none;
    }

    .premium-project-button,
    .premium-project-button-page {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        pointer-events: auto !important;
    }
}
