/* ============================================
   Chronos Brasil — Components
   Cards, badges, buttons, inputs, tooltips,
   progress bars, skeletons
   ============================================ */

/* ---- Header / Navigation ---- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: var(--glass-border);
    height: 72px;
    display: flex;
    align-items: center;
    transition: background var(--duration-normal) var(--ease-out);
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--sp-6);
}

.header__logo {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    font-size: var(--text-xl);
    color: var(--fg-primary);
    text-decoration: none;
}

.header__logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: var(--text-lg);
}

.header__nav {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}

.header__link {
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--fg-muted);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.header__link:hover {
    color: var(--fg-primary);
    background: var(--bg-surface);
}

.header__link.active {
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
}

.header__actions {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

/* Mobile menu */
.header__menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--fg-primary);
    cursor: pointer;
    padding: var(--sp-2);
    border-radius: var(--radius-sm);
}

.header__menu-toggle:hover {
    background: var(--bg-surface);
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-out);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.card--glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
}

.card--flat {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
}

.card--flat:hover {
    transform: none;
}

.card--stat {
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.card--stat .card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    margin-bottom: var(--sp-1);
}

.card--stat .card__value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--fg-primary);
}

.card--stat .card__label {
    font-size: var(--text-sm);
    color: var(--fg-muted);
    font-weight: var(--font-medium);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.02em;
    white-space: nowrap;
    line-height: 1.6;
}

.badge--nacional    { color: var(--badge-nacional);    background: var(--badge-nacional-bg); }
.badge--bancario    { color: var(--badge-bancario);    background: var(--badge-bancario-bg); }
.badge--facultativo { color: var(--badge-facultativo); background: var(--badge-facultativo-bg); }
.badge--lunar       { color: var(--badge-lunar);       background: var(--badge-lunar-bg); }
.badge--estacao     { color: var(--badge-estacao);      background: var(--badge-estacao-bg); }
.badge--especial    { color: var(--badge-especial);    background: var(--badge-especial-bg); }
.badge--default     { color: var(--badge-default);     background: var(--badge-default-bg); }

.badge--sm {
    padding: 1px 6px;
    font-size: 10px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border: none;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.5;
}

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

.btn--primary:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.btn--secondary {
    background: var(--bg-surface);
    color: var(--fg-primary);
    border: 1px solid var(--border-color);
}

.btn--secondary:hover {
    border-color: var(--border-color-hover);
    background: var(--bg-card);
}

.btn--ghost {
    background: transparent;
    color: var(--fg-muted);
}

.btn--ghost:hover {
    color: var(--fg-primary);
    background: var(--bg-surface);
}

.btn--danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-error);
}

.btn--danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn--sm {
    padding: var(--sp-1) var(--sp-3);
    font-size: var(--text-xs);
}

.btn--lg {
    padding: var(--sp-3) var(--sp-6);
    font-size: var(--text-base);
    border-radius: var(--radius-md);
}

.btn--icon {
    padding: var(--sp-2);
    width: 36px;
    height: 36px;
}

/* ---- Form Inputs ---- */
.input {
    width: 100%;
    padding: var(--sp-2) var(--sp-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--fg-primary);
    transition: all var(--duration-fast) var(--ease-out);
    outline: none;
}

.input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input::placeholder {
    color: var(--fg-faint);
}

.input--sm {
    padding: var(--sp-1) var(--sp-2);
    font-size: var(--text-sm);
}

textarea.input {
    resize: vertical;
    min-height: 80px;
}

.select {
    appearance: none;
    padding-right: var(--sp-8);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B8AAD' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.form-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--fg-secondary);
}

/* ---- Toggle Switch ---- */
.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    cursor: pointer;
}

.toggle__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle__slider {
    width: 40px;
    height: 22px;
    background: var(--fg-faint);
    border-radius: var(--radius-full);
    transition: background var(--duration-fast) var(--ease-out);
    position: relative;
}

.toggle__slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--duration-fast) var(--ease-out);
}

.toggle__input:checked + .toggle__slider {
    background: var(--accent-primary);
}

.toggle__input:checked + .toggle__slider::after {
    transform: translateX(18px);
}

/* ---- Tooltips ---- */
.tooltip {
    position: relative;
}

.tooltip__content {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: var(--sp-2) var(--sp-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color-hover);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--fg-primary);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-fast) var(--ease-out);
    z-index: var(--z-tooltip);
    pointer-events: none;
    box-shadow: var(--shadow-lg);
}

.tooltip__content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bg-tertiary);
}

.tooltip:hover .tooltip__content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ---- Progress Bar ---- */
.progress {
    height: 6px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: var(--radius-full);
    transition: width var(--duration-slow) var(--ease-out);
}

.progress--lg {
    height: 10px;
}

/* ---- Circular Progress ---- */
.progress-circle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.progress-circle__svg {
    transform: rotate(-90deg);
}

.progress-circle__track {
    fill: none;
    stroke: var(--bg-surface);
    stroke-width: 6;
}

.progress-circle__bar {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset var(--duration-slow) var(--ease-out);
}

.progress-circle__value {
    position: absolute;
    font-family: var(--font-mono);
    font-weight: var(--font-bold);
    font-size: var(--text-xl);
}

/* ---- Loading Skeleton ---- */
.skeleton {
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.04) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

.skeleton--text {
    height: 14px;
    width: 80%;
}

.skeleton--title {
    height: 24px;
    width: 60%;
}

.skeleton--card {
    height: 120px;
    border-radius: var(--radius-lg);
}

.skeleton--circle {
    border-radius: 50%;
}

/* ---- Flash Messages ---- */
.flash {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    margin-bottom: var(--sp-4);
    animation: fadeInDown 0.3s var(--ease-out);
}

.flash--success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.flash--error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.flash--warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.flash--info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ---- Theme Switcher ---- */
.theme-switcher {
    position: relative;
    display: inline-flex;
}

.theme-switcher__toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--fg-muted);
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.theme-switcher__toggle:hover {
    border-color: var(--border-color-hover);
    color: var(--fg-primary);
}

.theme-switcher__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color-hover);
    border-radius: var(--radius-md);
    padding: var(--sp-1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--duration-fast) var(--ease-out);
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-lg);
}

.theme-switcher.open .theme-switcher__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-switcher__option {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--fg-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
}

.theme-switcher__option:hover {
    background: var(--bg-surface);
    color: var(--fg-primary);
}

.theme-switcher__option.active {
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
}

.theme-switcher__swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* ---- Cookie Banner ---- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-modal);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: var(--glass-border);
    padding: var(--sp-4) var(--sp-6);
    animation: slideUpBanner 0.5s var(--ease-out);
}

.cookie-banner__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
}

.cookie-banner__text {
    font-size: var(--text-sm);
    color: var(--fg-secondary);
    flex: 1;
}

.cookie-banner__actions {
    display: flex;
    gap: var(--sp-2);
    flex-shrink: 0;
}

.cookie-banner.hidden {
    display: none;
}

/* ---- Footer ---- */
.footer {
    border-top: 1px solid var(--border-color);
    padding: var(--sp-8) 0;
    margin-top: var(--sp-16);
}

.footer__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--sp-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer__text {
    font-size: var(--text-sm);
    color: var(--fg-faint);
}

.footer__links {
    display: flex;
    gap: var(--sp-4);
}

.footer__links a {
    font-size: var(--text-sm);
    color: var(--fg-muted);
    text-decoration: none;
}

.footer__links a:hover {
    color: var(--fg-primary);
}

/* ---- Empty State ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sp-16) var(--sp-6);
    text-align: center;
}

.empty-state__icon {
    font-size: 48px;
    color: var(--fg-faint);
    margin-bottom: var(--sp-4);
}

.empty-state__title {
    font-size: var(--text-xl);
    color: var(--fg-secondary);
    margin-bottom: var(--sp-2);
}

.empty-state__text {
    font-size: var(--text-sm);
    color: var(--fg-muted);
    max-width: 400px;
}

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    font-weight: var(--font-semibold);
    color: var(--fg-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.table td {
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border-color);
    color: var(--fg-secondary);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: var(--day-hover-bg);
}

/* ---- Filter Pills ---- */
.filters {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
    margin-bottom: var(--sp-6);
}

.filter-pill {
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--fg-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}

.filter-pill:hover {
    color: var(--fg-primary);
    border-color: var(--border-color-hover);
}

.filter-pill.active {
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

/* ---- PIX Notice Card ---- */
.notice-card {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-4);
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-md);
}

.notice-card__icon {
    font-size: var(--text-xl);
    flex-shrink: 0;
    margin-top: 2px;
}

.notice-card__text {
    font-size: var(--text-sm);
    color: var(--fg-secondary);
    line-height: var(--leading-relaxed);
}
