/**
 * Favorites CSS - Dark Theme
 * Uses --pub-* tokens from public.css
 */

/* ========== Favorite Button (global) ========== */
.favorite-btn {
    position: relative;
    cursor: pointer;
}
.favorite-btn:hover {
    border-color: var(--pub-accent) !important;
    color: var(--pub-accent) !important;
}
.favorite-btn.favorited {
    background: var(--pub-accent-soft) !important;
    border-color: var(--pub-accent) !important;
    color: var(--pub-accent) !important;
}
.favorite-btn.favorited:hover {
    background: rgba(227, 6, 19, 0.2) !important;
}
.favorite-btn i {
    transition: all 0.2s ease;
    transform-origin: center;
}
.favorite-btn:active i { transform: scale(1.2); }
.favorite-btn.favorited i { animation: heartBeat 0.6s ease-in-out; }
.favorite-btn:focus {
    outline: 2px solid var(--pub-accent);
    outline-offset: 2px;
}
@keyframes heartBeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    40% { transform: scale(1.1); }
    60% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* ========== Counter Badge ========== */
.favorites-counter {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--pub-accent);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(227, 6, 19, 0.3);
    animation: fadeInScale 0.3s ease;
}
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0); }
    to { opacity: 1; transform: scale(1); }
}

/* ========== Floating Button ========== */
.favorites-floating {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--pub-accent);
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 20px rgba(227, 6, 19, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    cursor: pointer;
}
.favorites-floating:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(227, 6, 19, 0.4);
}
.favorites-floating.hidden {
    transform: translateY(100px);
    opacity: 0;
    pointer-events: none;
}

/* ========== Page Hero ========== */
.fav-hero {
    position: relative;
    padding: 7rem 2rem 3rem;
    text-align: center;
    background: var(--pub-bg-alt);
    border-bottom: 1px solid var(--pub-border);
    overflow: hidden;
}
.fav-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(227,6,19,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.fav-hero h1 {
    font-family: var(--font-brand);
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 800;
    color: var(--pub-text);
    margin-bottom: 0.5rem;
    position: relative;
}
.fav-hero p {
    font-size: 1rem;
    color: var(--pub-text-secondary);
    position: relative;
}

/* ========== Stats ========== */
.fav-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.fav-stat {
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    text-align: center;
    transition: border-color 0.2s;
}
.fav-stat:hover {
    border-color: var(--pub-border-hover);
}
.fav-stat-value {
    font-family: var(--font-brand);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--pub-accent);
    margin-bottom: 0.25rem;
}
.fav-stat-label {
    color: var(--pub-text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

/* ========== Toolbar ========== */
.fav-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: var(--radius-lg);
}
.fav-toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.fav-toolbar-left h2 {
    font-family: var(--font-brand);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pub-text);
}
.fav-toolbar-left .fav-count {
    font-size: 0.8rem;
    color: var(--pub-text-muted);
}
.fav-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.fav-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--pub-border);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--pub-text);
    background: var(--pub-surface-raised);
}
.fav-toolbar-btn:hover:not(:disabled) {
    border-color: var(--pub-border-hover);
    background: var(--pub-surface-hover);
}
.fav-toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.fav-toolbar-btn.blue { border-color: rgba(59,130,246,0.3); color: var(--pub-blue); }
.fav-toolbar-btn.blue:hover:not(:disabled) { background: rgba(59,130,246,0.1); }
.fav-toolbar-btn.green { border-color: rgba(34,197,94,0.3); color: var(--pub-green); }
.fav-toolbar-btn.green:hover:not(:disabled) { background: rgba(34,197,94,0.1); }
.fav-toolbar-btn.red { border-color: rgba(227,6,19,0.3); color: var(--pub-accent); }
.fav-toolbar-btn.red:hover:not(:disabled) { background: var(--pub-accent-soft); }

/* ========== Compare Mode ========== */
.fav-compare-mode {
    background: var(--pub-surface);
    border: 2px dashed var(--pub-border-hover);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}
.fav-compare-mode i { color: var(--pub-text-muted); }
.fav-compare-mode h3 {
    font-family: var(--font-brand);
    color: var(--pub-text);
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.fav-compare-mode p {
    color: var(--pub-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.fav-compare-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}
.fav-compare-btn.go {
    background: var(--pub-green);
    color: #fff;
}
.fav-compare-btn.go:hover:not(:disabled) { background: #16a34a; }
.fav-compare-btn.go:disabled { opacity: 0.4; cursor: not-allowed; }
.fav-compare-btn.cancel {
    background: var(--pub-surface-raised);
    color: var(--pub-text-secondary);
    border: 1px solid var(--pub-border);
}
.fav-compare-btn.cancel:hover { background: var(--pub-surface-hover); }

/* ========== Favorites Grid ========== */
.fav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* ========== Favorite Card ========== */
.fav-card {
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}
.fav-card:hover {
    transform: translateY(-4px);
    border-color: var(--pub-border-hover);
    box-shadow: var(--shadow-card-hover);
}
.fav-card:focus-within {
    box-shadow: 0 0 0 3px var(--pub-accent-soft);
}

/* Card Image */
.fav-card-img {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: var(--pub-bg);
}
.fav-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.fav-card:hover .fav-card-img img { transform: scale(1.05); }
.fav-card-img .img-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--pub-surface) 0%, transparent 50%);
    pointer-events: none;
}
.fav-card-remove {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: 50%;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pub-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    z-index: 5;
}
.fav-card-remove:hover {
    background: var(--pub-accent);
    color: #fff;
    border-color: var(--pub-accent);
    transform: scale(1.1);
}

/* Card Body */
.fav-card-body { padding: 1.25rem; }
.fav-card-title {
    font-family: var(--font-brand);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pub-text);
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}
.fav-card:hover .fav-card-title { color: var(--pub-accent); }
.fav-card-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--pub-text-muted);
}
.fav-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.fav-card-meta i { color: var(--pub-accent); font-size: 0.7rem; }
.fav-card-price {
    font-family: var(--font-brand);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--pub-accent);
    margin-bottom: 1rem;
}
.fav-card-actions {
    display: flex;
    gap: 0.6rem;
}
.fav-card-actions .fav-btn {
    flex: 1;
    padding: 0.7rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.8rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: none;
    cursor: pointer;
}
.fav-btn.primary {
    background: var(--pub-accent);
    color: #fff;
}
.fav-btn.primary:hover {
    background: var(--pub-accent-hover);
    box-shadow: 0 4px 16px var(--pub-accent-glow);
}
.fav-btn.whatsapp {
    background: var(--pub-green);
    color: #fff;
}
.fav-btn.whatsapp:hover {
    background: #16a34a;
    box-shadow: 0 4px 16px rgba(34,197,94,0.35);
}

/* ========== Empty State ========== */
.fav-empty {
    text-align: center;
    padding: 4rem 2rem;
}
.fav-empty-icon {
    width: 5rem;
    height: 5rem;
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    color: var(--pub-text-muted);
}
.fav-empty h3 {
    font-family: var(--font-brand);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--pub-text);
    margin-bottom: 0.5rem;
}
.fav-empty p {
    color: var(--pub-text-secondary);
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.9rem;
}
.fav-empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--pub-accent);
    color: #fff;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
}
.fav-empty-cta:hover {
    background: var(--pub-accent-hover);
    box-shadow: var(--shadow-glow);
}

/* ========== Loading ========== */
.fav-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem;
}
.fav-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--pub-border);
    border-top-color: var(--pub-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Comparison Mode (selection) ========== */
.favorites-compare-active .fav-card {
    cursor: pointer;
    border: 2px solid transparent;
}
.favorites-compare-active .fav-card.selected {
    border-color: var(--pub-accent);
    box-shadow: 0 0 0 3px var(--pub-accent-soft);
}
.fav-selection-indicator {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    background: var(--pub-accent);
    color: white;
    border-radius: 50%;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 5;
}
.fav-card.selected .fav-selection-indicator { opacity: 1; }

/* ========== Compare Page ========== */
.cmp-hero {
    position: relative;
    padding: 7rem 2rem 2rem;
    background: var(--pub-bg-alt);
    border-bottom: 1px solid var(--pub-border);
    overflow: hidden;
}
.cmp-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(59,130,246,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.cmp-hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}
.cmp-hero h1 {
    font-family: var(--font-brand);
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 800;
    color: var(--pub-text);
    margin-bottom: 0.35rem;
}
.cmp-hero p {
    font-size: 0.95rem;
    color: var(--pub-text-secondary);
}
.cmp-hero-actions {
    display: flex;
    gap: 0.6rem;
}
.cmp-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--pub-text-secondary);
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}
.cmp-hero-btn:hover {
    border-color: var(--pub-border-hover);
    color: var(--pub-text);
    background: var(--pub-surface-hover);
}

/* Compare Table */
.cmp-table {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.cmp-table-card {
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.cmp-table-header {
    background: var(--pub-bg);
    padding: 1.25rem;
    border-bottom: 1px solid var(--pub-border);
}
.cmp-table-row {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pub-border);
    transition: background 0.15s;
}
.cmp-table-row:last-child { border-bottom: none; }
.cmp-table-row:hover { background: var(--pub-surface-raised); }
.cmp-table-row.alt { background: var(--pub-bg); }
.cmp-table-row.alt:hover { background: var(--pub-surface-raised); }
.cmp-label {
    font-weight: 600;
    color: var(--pub-text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cmp-label i { font-size: 0.8rem; }
.cmp-value {
    text-align: center;
    font-weight: 600;
    color: var(--pub-text);
    font-size: 0.9rem;
}
.cmp-value.price {
    font-family: var(--font-brand);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--pub-accent);
}
.cmp-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}
.cmp-badge.blue { background: rgba(59,130,246,0.15); color: var(--pub-blue); }
.cmp-badge.green { background: rgba(34,197,94,0.15); color: var(--pub-green); }
.cmp-table-actions {
    padding: 1.25rem;
    border-top: 1px solid var(--pub-border);
    background: var(--pub-bg);
}
.cmp-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    width: 100%;
}
.cmp-action-btn.details {
    background: var(--pub-accent);
    color: #fff;
}
.cmp-action-btn.details:hover {
    background: var(--pub-accent-hover);
    box-shadow: 0 4px 16px var(--pub-accent-glow);
}
.cmp-action-btn.wpp {
    background: var(--pub-green);
    color: #fff;
}
.cmp-action-btn.wpp:hover {
    background: #16a34a;
    box-shadow: 0 4px 16px rgba(34,197,94,0.35);
}

/* Compare Stats */
.cmp-stats {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}
.cmp-stat-card {
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.cmp-stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.cmp-stat-icon.green { background: rgba(34,197,94,0.12); color: var(--pub-green); }
.cmp-stat-icon.blue { background: rgba(59,130,246,0.12); color: var(--pub-blue); }
.cmp-stat-icon.purple { background: rgba(168,85,247,0.12); color: #a855f7; }
.cmp-stat-label {
    font-size: 0.8rem;
    color: var(--pub-text-muted);
    font-weight: 500;
}
.cmp-stat-value {
    font-family: var(--font-brand);
    font-weight: 700;
    color: var(--pub-text);
    font-size: 1rem;
}

/* Toast */
.fav-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9999;
    animation: toastIn 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(12px);
}
.fav-toast.success { background: rgba(34,197,94,0.9); }
.fav-toast.warning { background: rgba(245,158,11,0.9); }
.fav-toast.error { background: rgba(227,6,19,0.9); }
.fav-toast.info { background: rgba(59,130,246,0.9); }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .favorites-floating { bottom: 80px; }
    .fav-grid { grid-template-columns: 1fr; gap: 1rem; }
    .fav-toolbar { flex-direction: column; gap: 1rem; }
    .fav-toolbar-left, .fav-toolbar-right { width: 100%; justify-content: center; }
    .fav-toolbar-right { flex-wrap: wrap; }
    .fav-stats { grid-template-columns: repeat(2, 1fr); }
    .cmp-hero-inner { flex-direction: column; text-align: center; gap: 1rem; }
    .cmp-hero-actions { justify-content: center; }
}
@media (max-width: 480px) {
    .fav-stats { grid-template-columns: 1fr; }
    .fav-card-meta { flex-direction: column; gap: 0.35rem; }
    .favorites-floating { width: 48px; height: 48px; font-size: 18px; bottom: 16px; left: 16px; }
}

/* ========== Print ========== */
@media print {
    .favorites-floating, .fav-card-remove, .fav-toolbar, .fav-hero,
    .cmp-hero-actions, .cmp-table-actions { display: none !important; }
    .fav-card, .cmp-table-card, .cmp-stat-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    body { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ========== Animations ========== */
.fav-card-enter { animation: slideInUp 0.3s ease-out; }
.fav-card-exit { animation: slideOutDown 0.3s ease-in forwards; }
@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideOutDown {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(20px); }
}
