/**
 * DONGNIME — Components CSS (Modular)
 * Reusable UI components untuk semua halaman
 * Theme: Dark/Neon Red Cinematic
 */

/* ═══════════════════════════════════════════════════
   0. UTILITIES
   ═══════════════════════════════════════════════════ */
.container { max-width: 1400px; margin: 0 auto; padding: 0 40px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; } .justify-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ═══════════════════════════════════════════════════
   1. BUTTONS
   ═══════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.4;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-glow);
    border-color: var(--accent-glow);
    box-shadow: var(--shadow-red);
}
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--accent-soft);
    color: var(--accent);
}
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon {
    width: 40px; height: 40px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
}
.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════
   2. BADGES
   ═══════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-new { background: var(--accent); color: #fff; }
.badge-hot {
    background: linear-gradient(135deg, #ff6b00, var(--accent));
    color: #fff;
}
.badge-ongoing { background: var(--blue); color: #fff; }
.badge-completed { background: var(--green); color: #000; }
.badge-upcoming { background: var(--gold); color: #000; }
.badge-vip { background: linear-gradient(135deg, #ffd700, #ffaa00); color: #000; }
.badge-sub { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-dark); }
.badge-free { background: var(--green-soft); color: var(--green); border: 1px solid var(--green); }
.badge-4k { background: #8b5cf6; color: #fff; }
.badge-720p { background: var(--text-muted); color: var(--bg-primary); }
.badge-1080p { background: var(--blue); color: #fff; }

/* ═══════════════════════════════════════════════════
   3. CARDS
   ═══════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}
.card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.card-img {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: var(--bg-elevated);
}
.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}
.card:hover .card-img img { transform: scale(1.08); }
.card-body { padding: 14px 16px; }
.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--gold);
    font-weight: 600;
}

/* Card Placeholder (fallback jika image gagal) */
.card-placeholder {
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, #1a1a1f 0%, #252530 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    color: var(--text-dim);
}
.card-placeholder-icon { font-size: 2.5rem; opacity: 0.4; }
.card-placeholder-text { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.5; }

/* ═══════════════════════════════════════════════════
   4. FORM ELEMENTS
   ═══════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-control::placeholder { color: var(--text-dim); }
.form-control:disabled { opacity: 0.6; cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* Search Input khusus */
.search-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 9px 18px 9px 42px;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    transition: all var(--transition-fast);
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: var(--bg-elevated);
}
.search-wrap {
    position: relative;
}
.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Toggle / Switch */
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { display: none; }
.toggle-slider {
    width: 44px; height: 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50px;
    position: relative;
    transition: all var(--transition-fast);
}
.toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    background: var(--text-muted);
    border-radius: 50%;
    top: 2px; left: 2px;
    transition: all var(--transition-fast);
}
.toggle input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}
.toggle input:checked + .toggle-slider::after {
    transform: translateX(20px);
    background: #fff;
}

/* ═══════════════════════════════════════════════════
   5. LOADING / SKELETON
   ═══════════════════════════════════════════════════ */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton Shimmer */
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-card {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: var(--radius-lg);
}
.skeleton-text {
    height: 14px;
    margin-top: 10px;
    border-radius: 4px;
}
.skeleton-text-sm { width: 60%; height: 10px; }
.skeleton-text-lg { width: 80%; height: 16px; }

/* ═══════════════════════════════════════════════════
   6. TOAST / NOTIFICATION
   ═══════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 420px;
    animation: toastIn 0.3s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}
@keyframes toastOut {
    to { opacity: 0; transform: translateY(10px) scale(0.95); }
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid #ef4444; }
.toast-warning { border-left: 3px solid var(--gold); }
.toast-info    { border-left: 3px solid var(--blue); }
.toast-title   { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.toast-message { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.toast-close {
    margin-left: auto;
    background: none; border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 2px;
}
.toast-close:hover { color: var(--text-primary); }

/* ═══════════════════════════════════════════════════
   7. PAGINATION
   ═══════════════════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px 0;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px; height: 36px;
    padding: 0 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.88rem;
    text-decoration: none;
    transition: all var(--transition-fast);
}
.page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}
.page-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.page-link:disabled, .page-link.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.pagination-info {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 10px;
}

/* ═══════════════════════════════════════════════════
   8. TAGS / CHIPS
   ═══════════════════════════════════════════════════ */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 50px;
    border: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
}
.tag:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}
.tag-active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.tag-active:hover {
    background: var(--accent-glow);
    color: #fff;
}

/* ═══════════════════════════════════════════════════
   9. TABS
   ═══════════════════════════════════════════════════ */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition-fast);
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ═══════════════════════════════════════════════════
   10. MODAL
   ═══════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: all var(--transition-normal);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.modal-close {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--accent); }
.modal-body { padding: 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════
   11. ALERT / MESSAGE BOX
   ═══════════════════════════════════════════════════ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    border-left: 4px solid;
    margin-bottom: 16px;
    font-size: 0.88rem;
}
.alert-success { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.alert-error   { background: rgba(239,68,68,0.1); border-color: #ef4444; color: #fca5a5; }
.alert-warning { background: rgba(251,191,36,0.1); border-color: var(--gold); color: var(--gold); }
.alert-info    { background: rgba(59,130,246,0.1); border-color: var(--blue); color: #93c5fd; }

/* ═══════════════════════════════════════════════════
   12. PROGRESS BAR
   ═══════════════════════════════════════════════════ */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 50px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-dark), var(--accent));
    border-radius: 50px;
    transition: width 0.4s ease;
}

/* ═══════════════════════════════════════════════════
   13. EMPTY STATE
   ═══════════════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 4rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state-title { font-size: 1.2rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-desc { font-size: 0.9rem; max-width: 360px; margin-bottom: 20px; }

/* ═══════════════════════════════════════════════════
   14. AVATAR
   ═══════════════════════════════════════════════════ */
.avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent);
    border: 2px solid var(--border);
    flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.6rem; }

/* ═══════════════════════════════════════════════════
   15. DROPDOWN
   ═══════════════════════════════════════════════════ */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
    padding: 6px;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
    display: block;
    padding: 8px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.88rem;
    text-decoration: none;
    transition: all var(--transition-fast);
}
.dropdown-item:hover {
    background: var(--accent-soft);
    color: var(--accent);
}
.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

/* ═══════════════════════════════════════════════════
   16. SCROLLABLE WRAPPER
   ═══════════════════════════════════════════════════ */
.scroll-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 10px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scroll-row::-webkit-scrollbar { display: none; }
.scroll-row > * { scroll-snap-align: start; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════
   17. PWA INSTALL BANNER
   ═══════════════════════════════════════════════════ */
.pwa-install-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-elevated);
    border-top: 1px solid var(--accent);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 999;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.pwa-install-banner p { font-size: 0.9rem; color: var(--text-secondary); }
.pwa-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}
