/* =====================================================================
   Meeqat Components — Modern Serene
   ---------------------------------------------------------------------
   Reusable UI primitives. Import AFTER design-tokens.css.
   These classes are additive — existing .btn, .card etc. in main.css
   continue working. New code should prefer these variants.
   ===================================================================== */

/* =====================================================================
   BUTTONS
   ===================================================================== */

/* Base (.btn is already defined in main.css — we enhance with variants) */
.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid transparent;
}
.btn-ghost:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.btn-accent {
    background: var(--brand-copper);
    color: #fff;
}
.btn-accent:hover {
    background: var(--brand-copper-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-pill {
    border-radius: var(--radius-full);
}

.btn-icon-only {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =====================================================================
   CARDS — Modern, flat-ish, subtle border
   ===================================================================== */
.card-v2 {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: var(--transition);
}
.card-v2:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-md);
}

.card-v2-quiet {
    background: var(--color-surface);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

/* =====================================================================
   INPUTS
   ===================================================================== */
.input-v2 {
    width: 100%;
    padding: 12px 14px;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    transition: var(--transition-fast);
}
.input-v2::placeholder {
    color: var(--color-text-subtle);
}
.input-v2:focus {
    outline: none;
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 4px var(--brand-teal-soft);
}

/* =====================================================================
   BADGES / PILLS
   ===================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    letter-spacing: 0.02em;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.badge-teal    { background: var(--brand-teal-soft);    color: var(--brand-teal);    border-color: transparent; }
.badge-copper  { background: var(--brand-copper-soft);  color: var(--brand-copper);  border-color: transparent; }
.badge-success { background: var(--color-success-soft); color: var(--color-success); border-color: transparent; }
.badge-error   { background: var(--color-error-soft);   color: var(--color-error);   border-color: transparent; }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); border-color: transparent; }
.badge-info    { background: var(--color-info-soft);    color: var(--color-info);    border-color: transparent; }

/* =====================================================================
   THEME TOGGLE BUTTON
   ===================================================================== */
.theme-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--color-surface-alt);
    color: var(--brand-teal);
    border-color: var(--brand-teal);
}
.theme-toggle svg {
    width: 18px;
    height: 18px;
}
@media (max-width: 768px) {
    .theme-toggle {
        width: 44px;
        height: 44px;
    }
    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }
}
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }

/* =====================================================================
   DIVIDERS
   ===================================================================== */
.divider {
    height: 1px;
    background: var(--color-border);
    border: 0;
    margin: var(--space-4) 0;
}
.divider-soft {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-border), transparent);
    border: 0;
    margin: var(--space-4) 0;
}

/* =====================================================================
   EMPTY STATES
   ===================================================================== */
.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--color-text-muted);
}
.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-3);
    color: var(--color-text-subtle);
}
.empty-state-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}
.empty-state-desc {
    font-size: var(--fs-base);
    color: var(--color-text-muted);
}

/* =====================================================================
   SKELETON
   ===================================================================== */
.skeleton-v2 {
    background: linear-gradient(90deg,
        var(--color-surface-alt) 25%,
        var(--color-surface-sunken) 50%,
        var(--color-surface-alt) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =====================================================================
   MOBILE BOTTOM TAB BAR (optional — can be opted in per page)
   ===================================================================== */
.bottom-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    z-index: var(--z-sticky);
    justify-content: space-around;
    align-items: stretch;
}
.bottom-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border: 0;
    background: transparent;
    color: var(--color-text-subtle);
    font-size: 10px;
    font-weight: var(--fw-medium);
    text-decoration: none;
    border-radius: var(--radius-md);
    min-height: 48px;
    transition: var(--transition-fast);
}
.bottom-tab.active {
    color: var(--brand-teal);
}
.bottom-tab svg,
.bottom-tab i {
    width: 22px;
    height: 22px;
}
@media (max-width: 640px) {
    .bottom-tabs.is-enabled { display: flex; }
    body.has-bottom-tabs { padding-bottom: 72px; }
}

/* =====================================================================
   Typography helpers
   ===================================================================== */
.text-thin       { font-weight: var(--fw-thin); }
.text-light      { font-weight: var(--fw-light); }
.text-regular    { font-weight: var(--fw-regular); }
.text-medium     { font-weight: var(--fw-medium); }
.text-semibold   { font-weight: var(--fw-semibold); }
.text-bold       { font-weight: var(--fw-bold); }

.text-display {
    font-size: var(--fs-display);
    font-weight: var(--fw-thin);
    letter-spacing: -0.02em;
    line-height: 0.95;
}
.text-mono {
    font-family: var(--font-mono);
}

/* Screen-reader-only (utility) */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
