/**
 * Miscellaneous Components Styles
 * ================================
 */

/* App Loading State */
.app-loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: var(--z-max);
    transition: opacity var(--duration-slow) var(--ease-default);
}

.app-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    width: 80px;
    height: 80px;
    color: var(--accent-primary);
    animation: pulse 2s ease-in-out infinite;
}

.loading-logo svg,
.loading-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* App Loader Overlay */
.app-loader {
    position: fixed;
    inset: 0;
    background: var(--surface-overlay);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-default);
}

.app-loader.visible {
    opacity: 1;
    visibility: visible;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-5);
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow-xl);
    pointer-events: auto;
    transition: all var(--duration-normal) var(--ease-default);
}

.toast-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-warning {
    border-left: 3px solid var(--warning);
}

.toast-danger {
    border-left: 3px solid var(--danger);
}

/* Card Feedback */
.card-feedback {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--space-5));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-default);
    z-index: var(--z-toast);
}

.card-feedback.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Grabbing Cursor */
.grabbing {
    cursor: grabbing !important;
    user-select: none;
}

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

.empty-state-icon {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    margin-bottom: var(--space-5);
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 1;
}

.empty-state-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-base);
    color: var(--text-secondary);
    max-width: 400px;
}

/* Search Bar */
.search-bar {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.search-bar-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    padding-left: var(--space-10);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--text-primary);
    transition: all var(--duration-fast) var(--ease-default);
}

.search-bar-input::placeholder {
    color: var(--text-tertiary);
}

.search-bar-input:focus {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-bar-icon {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-bar-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Level Badges */
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

.level-badge-beginner {
    background: var(--success-soft);
    color: var(--success);
}

.level-badge-intermediate {
    background: var(--warning-soft);
    color: var(--warning);
}

.level-badge-advanced {
    background: var(--danger-soft);
    color: var(--danger);
}

/* Progress Ring */
.progress-ring {
    position: relative;
    width: 48px;
    height: 48px;
}

.progress-ring-circle {
    fill: none;
    stroke: var(--border-default);
    stroke-width: 4;
}

.progress-ring-progress {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 4;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset var(--duration-slow) var(--ease-default);
}

.progress-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-primary);
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-fast) var(--ease-default);
    z-index: var(--z-tooltip);
    box-shadow: var(--shadow-md);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-4) 0;
}

.divider-vertical {
    width: 1px;
    height: auto;
    align-self: stretch;
    background: var(--border-subtle);
    margin: 0 var(--space-4);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-default);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--border-default);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--duration-normal) var(--ease-bounce);
    box-shadow: var(--shadow-xl);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    transition: all var(--duration-fast) var(--ease-default);
}

.modal-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-close svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.modal-body {
    padding: var(--space-5);
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* Expired Subscription Modal */
.modal-expired {
    max-width: 400px;
}

.modal-expired-icon {
    color: var(--warning);
    margin-bottom: var(--space-4);
}

.modal-expired-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--space-4) 0;
}

.modal-expired-plan {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.modal-expired-date {
    font-size: var(--text-sm);
    color: var(--warning);
    font-weight: 500;
    margin-bottom: var(--space-4);
}

.modal-expired-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 var(--space-6) 0;
}

.modal-expired-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
}

/* =============================================
   SUBSCRIPTION FILTER (Sliding Tabs)
   ============================================= */

.subscription-filter {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-8);
    margin-bottom: var(--space-2);
}

.subscription-filter__label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    white-space: nowrap;
}

.subscription-filter__tabs {
    --tab-count: 3;
    position: relative;
    display: inline-flex;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 4px;
}

/* Sliding indicator - positioned based on actual tab positions */
.subscription-filter__slider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: var(--slider-width, 33.33%);
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: var(--radius-full);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(var(--slider-offset, 0));
    box-shadow: 0 2px 8px rgba(var(--accent-rgb, 196, 161, 95), 0.3);
    z-index: 0;
    pointer-events: none;
}

.subscription-filter__tab {
    position: relative;
    z-index: 1;
    padding: var(--space-2) var(--space-5);
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.subscription-filter__tab:hover {
    color: var(--text-primary);
}

.subscription-filter__tab.active {
    color: var(--bg-primary);
    font-weight: 600;
}

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

.empty-filter-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-5);
}

.empty-filter-icon svg {
    width: 40px;
    height: 40px;
    color: var(--text-tertiary);
}

.empty-filter-state h3 {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
}

.empty-filter-state p {
    font-size: var(--text-base);
    color: var(--text-tertiary);
    margin: 0;
}

/* Responsive — swipeable badges */
@media (max-width: 768px) {
    .subscription-filter {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-3) 0;
        gap: var(--space-2);
    }

    .subscription-filter__label {
        padding-left: var(--space-5);
        font-size: var(--text-xs);
        color: var(--text-tertiary);
    }

    .subscription-filter__tabs {
        display: flex;
        gap: var(--space-2);
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: var(--space-1) var(--space-5);
        background: transparent;
        border: none;
        border-radius: 0;
    }

    .subscription-filter__tabs::-webkit-scrollbar {
        display: none;
    }

    /* Hide the sliding indicator on mobile */
    .subscription-filter__slider {
        display: none;
    }

    .subscription-filter__tab {
        flex-shrink: 0;
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-xs);
        font-weight: 500;
        background: var(--bg-card);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-full);
        color: var(--text-secondary);
        transition: all 0.2s ease;
    }

    .subscription-filter__tab.active {
        background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
        border-color: transparent;
        color: var(--bg-primary);
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(212, 175, 125, 0.25);
    }
}

/* =============================================
   DONATE BUTTON (Floating)
   ============================================= */

/* Sidebar donate button (desktop) */
.sidebar-donate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #e74c6f 0%, #c0392b 100%);
    border: none;
    border-radius: 50px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(231, 76, 111, 0.3);
    transition: all 0.25s ease;
    margin-top: var(--space-3);
    animation: donatePulse 3s ease-in-out infinite;
}

.sidebar-donate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(231, 76, 111, 0.45);
}

.sidebar-donate-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

@keyframes donatePulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(231, 76, 111, 0.3); }
    50% { box-shadow: 0 4px 18px rgba(231, 76, 111, 0.5); }
}

/* Mobile floating donate button (heart icon only) */
.donate-btn-mobile {
    display: none;
}

@media (max-width: 768px) {
    .donate-btn-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 100px;
        right: 16px;
        z-index: 900;
        padding: 14px;
        background: linear-gradient(135deg, #e74c6f 0%, #c0392b 100%);
        border: none;
        border-radius: 50%;
        color: #fff;
        text-decoration: none;
        cursor: pointer;
        box-shadow: 0 4px 16px rgba(231, 76, 111, 0.35);
        animation: donatePulse 3s ease-in-out infinite;
    }
}

/* Hide mobile donate when sidebar or video player is open */
.sidebar.open ~ .donate-btn-mobile {
    display: none !important;
}

body:has(.video-player-overlay) .donate-btn-mobile {
    display: none !important;
}
