/* ===================================
   FYEV Events — Component Styles
   =================================== */

/* --- Splash Screen --- */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: var(--z-splash);
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-logo {
    text-align: center;
    animation: fadeInScale 0.8s ease both;
}

.splash-icon svg {
    width: 80px;
    height: 80px;
    margin-bottom: var(--space-6);
    filter: drop-shadow(0 0 30px rgba(99, 102, 241, 0.4));
}

.splash-title {
    font-size: var(--font-size-3xl);
    font-weight: 900;
    background: linear-gradient(135deg, #818cf8, #22d3ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-2);
}

.splash-subtitle {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--space-8);
}

.splash-loader {
    width: 120px;
    height: 3px;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 0 auto;
}

.splash-loader-bar {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: var(--radius-full);
    animation: loaderSlide 1.2s ease-in-out infinite;
}

/* --- App Shell --- */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* --- App Header --- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: var(--z-header);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 var(--space-4);
    max-width: 600px;
    margin: 0 auto;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
}

.header-left {
    justify-content: flex-start;
    flex-wrap: nowrap;
    flex-direction: row;
    gap: 4px;
    overflow: hidden;
}

.header-left>button {
    flex-shrink: 0;
}

.header-right {
    justify-content: flex-end;
    position: relative;
}

.header-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    text-align: center;
    color: var(--color-text);
    white-space: nowrap;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    pointer-events: none;
}

.btn-back {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.btn-back:active {
    background: var(--color-bg-card);
}

.btn-notification {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.btn-notification:active {
    background: var(--color-bg-card);
}

/* --- Language Toggle --- */
.btn-lang-toggle {
    min-width: 28px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--color-text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
    cursor: pointer;
    padding: 0 6px;
}

.btn-lang-toggle:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-lang-toggle:active {
    transform: scale(0.9);
}

/* --- Theme Toggle --- */
.btn-theme-toggle {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-theme-toggle:active {
    transform: scale(0.9);
}


.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    background: var(--color-error);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bounceIn 0.4s ease both;
}

/* --- Notification Panel Dropdown --- */
.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: 420px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: calc(var(--z-header) + 5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInScale 0.2s ease both;
    transform-origin: top right;
}

.notif-panel.hidden {
    display: none;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.notif-panel-header h3 {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.notif-panel-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.notif-status-on {
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.12);
}

.notif-status-off {
    color: var(--color-text-muted);
    background: rgba(100, 116, 139, 0.12);
}

.notif-status-off:hover {
    color: var(--color-primary-light);
    background: rgba(99, 102, 241, 0.12);
}

.notif-panel-list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.notif-panel-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
    color: var(--color-text-muted);
    text-align: center;
}

.notif-panel-empty svg {
    opacity: 0.3;
    margin-bottom: var(--space-3);
}

.notif-panel-empty p {
    font-size: var(--font-size-xs);
    margin: 0;
}

.notif-item {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--color-bg-card-hover);
}

.notif-item.notif-unread {
    background: rgba(99, 102, 241, 0.06);
}

.notif-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: 2px;
}

.notif-item-title {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.notif-unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
    box-shadow: 0 0 6px var(--color-primary-glow);
}

.notif-item-time {
    font-size: 10px;
    color: var(--color-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 1px;
}

.notif-item-body {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

@media (max-width: 400px) {
    .notif-panel {
        width: calc(100vw - 24px);
        right: -8px;
    }
}

/* --- Notification Popup (on click) --- */
.notif-popup {
    position: fixed;
    top: calc(var(--header-height) + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: calc(var(--z-modal) + 10);
    width: calc(100% - 24px);
    max-width: 420px;
    animation: notifPopupIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.notif-popup-content {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.notif-popup-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.notif-popup-body {
    flex: 1;
    min-width: 0;
}

.notif-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: 2px;
}

.notif-popup-title {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
}

.notif-popup-time {
    font-size: 10px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.notif-popup-text {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    line-height: 1.4;
    margin: 0;
    word-break: break-word;
}

.notif-popup-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: all var(--transition-fast);
    margin-top: -2px;
    margin-right: -4px;
}

.notif-popup-close:active {
    background: var(--color-bg-card);
    color: var(--color-text);
}

.notif-popup-out {
    animation: notifPopupOut 0.3s ease both;
}

@keyframes notifPopupIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes notifPopupOut {
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px) scale(0.95);
    }
}

/* --- Offline Banner --- */
.offline-banner {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: var(--z-header);
    background: rgba(245, 158, 11, 0.15);
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    padding: var(--space-2) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--color-warning);
    animation: slideDown 0.3s ease both;
}

/* --- Page Container --- */
.page-container {
    flex: 1;
    margin-top: var(--header-height);
    margin-bottom: var(--nav-height);
    padding-bottom: var(--safe-area-bottom);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
    /* Disable iOS rubber-band so our PTR can activate */
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    height: var(--nav-height);
    padding-bottom: var(--safe-area-bottom);
    z-index: var(--z-nav);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
}

@media (min-width: 601px) {
    .bottom-nav {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border-left: 1px solid var(--glass-border);
        border-right: 1px solid var(--glass-border);
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: 9px;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
    flex: 1;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.nav-item.active {
    color: var(--color-primary-light);
}

.nav-item.active svg {
    filter: drop-shadow(0 0 8px var(--color-primary-glow));
}

.nav-item:active {
    transform: scale(0.92);
}

/* --- Cards --- */
.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    transition: all var(--transition-base);
}

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

.card-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

/* --- Buttons --- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    font-weight: 600;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md), 0 0 20px var(--color-primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), 0 0 30px var(--color-primary-glow);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    background: var(--color-bg-card);
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
}

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

/* --- Search Bar --- */
.search-bar {
    position: relative;
    margin-bottom: var(--space-4);
}

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

.search-input {
    width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-3) 44px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
    outline: none;
}

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

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* --- Tags / Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary-light);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

.badge-accent {
    background: rgba(34, 211, 238, 0.15);
    color: var(--color-accent);
}

.badge-completed {
    background: rgba(100, 116, 139, 0.15);
    color: var(--color-text-muted);
}

/* --- Install Prompt --- */
.install-prompt {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-area-bottom) + var(--space-4));
    left: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-modal);
    animation: fadeInUp 0.5s ease both;
}

.install-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    max-width: 560px;
    margin: 0 auto;
}

.install-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.install-text {
    flex: 1;
    min-width: 0;
}

.install-text strong {
    font-size: var(--font-size-sm);
    display: block;
}

.install-text p {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.btn-install {
    padding: var(--space-2) var(--space-4);
    background: var(--color-primary);
    color: white;
    font-weight: 600;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-full);
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.btn-install:active {
    transform: scale(0.95);
}

.btn-dismiss {
    color: var(--color-text-muted);
    padding: var(--space-1);
    flex-shrink: 0;
}

/* --- Modal --- */
.modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease both;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    max-width: 360px;
    width: calc(100% - var(--space-8));
    text-align: center;
    animation: fadeInScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

.modal-content h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-2);
}

.modal-content p {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-6);
}

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

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

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-4);
    opacity: 0.4;
}

.empty-state p {
    font-size: var(--font-size-sm);
}

/* --- Skeleton Loading --- */
.skeleton {
    background: linear-gradient(90deg, var(--color-bg-card) 25%, var(--color-bg-card-hover) 50%, var(--color-bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-card {
    height: 120px;
    margin-bottom: var(--space-4);
}

/* --- Responsive Container --- */
.page-content {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-4);
}

@media (min-width: 768px) {
    .page-content {
        padding: var(--space-6);
    }
}

/* --- Livestream Button --- */
.livestream-btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    text-decoration: none;
    background: #FF0000 !important;
    color: #ffffff !important;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(255, 0, 0, 0.2);
    transition: all var(--transition-base);
    -webkit-tap-highlight-color: transparent;
}

.livestream-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.4);
    background: #e60000 !important;
}

.livestream-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(255, 0, 0, 0.2);
}

/* --- SW Update Banner --- */
.sw-update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: calc(var(--z-header) + 10);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: linear-gradient(135deg, var(--color-primary), #7c3aed);
    color: white;
    font-size: var(--font-size-xs);
    font-weight: 500;
    animation: slideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    justify-content: center;
}

.sw-update-banner svg {
    flex-shrink: 0;
    opacity: 0.9;
}

#sw-update-btn {
    margin-left: var(--space-2);
    padding: 3px var(--space-3);
    background: white;
    color: var(--color-primary);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 700;
    white-space: nowrap;
    transition: transform 0.15s ease;
}

#sw-update-btn:active {
    transform: scale(0.95);
}

/* --- Pull to Refresh --- */
.pull-to-refresh {
    position: fixed;
    top: var(--header-height);
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    z-index: calc(var(--z-header) - 1);
    width: 44px;
    height: 44px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0;
    pointer-events: none;
}

.pull-to-refresh.visible {
    opacity: 1;
}

.pull-to-refresh svg {
    color: var(--color-primary-light);
    transition: transform 0.2s ease;
}

.pull-to-refresh.spinning svg {
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}