/* ============================================================
   COMPONENTS.CSS — Reusable UI Components
   ResQplus IoT Product Website
   ============================================================ */


/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    transition: background var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-out),
                backdrop-filter var(--duration-normal) var(--ease-out);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 var(--border-subtle), var(--shadow-sm);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- Logo --- */
.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    letter-spacing: -0.02em;
    position: relative;
    z-index: var(--z-sticky);
}

.nav-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: var(--fw-extrabold);
    color: white;
}

.nav-logo span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Nav Links --- */
.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.nav-links a {
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    position: relative;
    padding: var(--space-xs) 0;
    transition: color var(--duration-fast) var(--ease-out);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width var(--duration-normal) var(--ease-out);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

/* --- Nav Dropdown --- */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.nav-dropdown-trigger svg {
    width: 14px;
    height: 14px;
    transition: transform var(--duration-fast) var(--ease-out);
}

.nav-dropdown:hover .nav-dropdown-trigger svg {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(8px);
    transition: all var(--duration-normal) var(--ease-out);
    box-shadow: var(--shadow-lg);
}

.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--fs-small);
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-out);
}

.nav-dropdown-menu a:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.nav-dropdown-menu a::after {
    display: none;
}

.nav-dropdown-menu .dropdown-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.nav-dropdown-menu .dropdown-text {
    display: flex;
    flex-direction: column;
}

.nav-dropdown-menu .dropdown-text span {
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    font-size: var(--fs-small);
}

.nav-dropdown-menu .dropdown-text small {
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

/* --- Nav CTA --- */
.nav-cta {
    margin-left: var(--space-md);
}

/* --- Mobile Menu Toggle --- */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    z-index: var(--z-sticky);
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    transition: all var(--duration-normal) var(--ease-out);
    transform-origin: center;
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* --- Mobile Nav --- */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        background: var(--bg-primary);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: var(--space-xl);
        opacity: 0;
        visibility: hidden;
        transition: all var(--duration-normal) var(--ease-out);
    }

    .nav-links.open {
        opacity: 1;
        visibility: visible;
    }

    .nav-links a {
        font-size: 1.25rem;
    }

    .nav-dropdown-menu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        min-width: auto;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: var(--space-xs) 0;
    }

    .nav-dropdown:hover .nav-dropdown-menu {
        transform: none;
    }

    .nav-cta {
        margin-left: 0;
    }
}


/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-body);
    font-size: var(--fs-button);
    font-weight: var(--fw-semibold);
    line-height: 1;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    white-space: nowrap;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.05), transparent);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.btn:hover::before {
    opacity: 1;
}

/* Primary Button */
.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary / Outline Button */
.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--accent-primary);
    padding: var(--space-xs) var(--space-md);
}

.btn-ghost:hover {
    background: var(--glass-bg);
}

/* Button Sizes */
.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--fs-body);
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--fs-xs);
}

/* Icon Button */
.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* Button with arrow */
.btn .arrow {
    transition: transform var(--duration-fast) var(--ease-out);
}

.btn:hover .arrow {
    transform: translateX(4px);
}


/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--border-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Glass Card */
.card-glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Card with gradient border on hover */
.card-gradient {
    position: relative;
}

.card-gradient::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: var(--accent-gradient);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-out);
}

.card-gradient:hover::before {
    opacity: 1;
}

/* Card Header */
.card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: var(--space-lg);
    transition: all var(--duration-normal) var(--ease-out);
}

.card:hover .card-icon {
    background: var(--accent-glow);
    border-color: var(--accent-primary);
}

.card h3 {
    margin-bottom: var(--space-sm);
}

.card p {
    font-size: var(--fs-small);
}


/* ============================================================
   BADGES / CHIPS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    padding: var(--space-2xs) var(--space-sm);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    border-radius: var(--radius-full);
    background: var(--glass-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.badge-accent {
    background: rgba(79, 110, 247, 0.12);
    border-color: rgba(79, 110, 247, 0.25);
    color: var(--accent-hover);
}

.badge-success {
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.25);
    color: var(--success);
}

.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}


/* ============================================================
   FORM INPUTS
   ============================================================ */
.form-group {
    position: relative;
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--fs-body);
    transition: all var(--duration-fast) var(--ease-out);
}

.form-input:hover {
    border-color: var(--border-light);
}

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

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 140px;
}

.form-error {
    font-size: var(--fs-xs);
    color: var(--error);
    margin-top: var(--space-2xs);
    display: none;
}

.form-group.error .form-input {
    border-color: var(--error);
}

.form-group.error .form-error {
    display: block;
}


/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-2xl);
    margin-bottom: var(--space-2xl);
}

.footer-brand {
    max-width: 320px;
}

.footer-brand .nav-logo {
    margin-bottom: var(--space-md);
}

.footer-brand p {
    font-size: var(--fs-small);
    margin-bottom: var(--space-lg);
}

.footer-socials {
    display: flex;
    gap: var(--space-sm);
}

.footer-socials a {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-muted);
    transition: all var(--duration-fast) var(--ease-out);
}

.footer-socials a:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
}

.footer-column h4 {
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
}

.footer-column a {
    display: block;
    font-size: var(--fs-small);
    color: var(--text-muted);
    padding: var(--space-2xs) 0;
    transition: color var(--duration-fast) var(--ease-out);
}

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

.footer-bottom {
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.footer-bottom-links {
    display: flex;
    gap: var(--space-lg);
}

.footer-bottom-links a {
    color: var(--text-muted);
    transition: color var(--duration-fast);
}

.footer-bottom-links a:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
}


/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
    width: 100%;
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-2xl) 0;
}

.divider-gradient {
    background: linear-gradient(90deg, transparent, var(--border-light), transparent);
}


/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-to-top {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--accent-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow-sm);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--duration-normal) var(--ease-out);
    z-index: var(--z-dropdown);
    cursor: pointer;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}


/* ============================================================
   LOADING SKELETON
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-elevated) 25%,
        var(--bg-surface) 50%,
        var(--bg-elevated) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ============================================================
   TOOLTIP
   ============================================================ */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-2xs) var(--space-sm);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-fast) var(--ease-out);
    pointer-events: none;
    z-index: var(--z-dropdown);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ============================================================
   PAGE HEADER (Global for inner pages)
   ============================================================ */
.page-header {
    position: relative;
    padding: calc(var(--nav-height) + var(--space-3xl)) 0 var(--space-3xl);
    text-align: center;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 60% at 50% 0%, var(--accent-glow), transparent);
    pointer-events: none;
}

.page-header .label { display: inline-block; margin-bottom: var(--space-md); }
.page-header h1 { margin-bottom: var(--space-md); position: relative; }
.page-header p { margin: 0 auto; max-width: 600px; font-size: var(--fs-body-lg); position: relative; }
