/* MI-style IPTV App UI */

.brand-block {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.brand-link {
    color: inherit;
    text-decoration: none;
}

.brand-logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    display: grid;
    place-items: center;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.35);
    flex-shrink: 0;
}

.brand-logo-mark svg {
    width: 22px;
    height: 22px;
    color: white;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.brand-logo {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.brand-slogan {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.header-slogan {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.login-brand {
    justify-content: center;
    margin-bottom: 0.5rem;
}

.login-brand .brand-logo {
    font-size: 1.2rem;
}

.login-splash {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    margin: 0.5rem 0 0.25rem;
    background: linear-gradient(135deg, #fff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 1.5rem;
    letter-spacing: 0.03em;
}

.app-footer-brand {
    text-align: center;
    padding: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.app-footer-brand strong {
    color: #c4b5fd;
    font-weight: 600;
}

.splash-brand {
    justify-content: center;
}

.splash-brand .brand-logo-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
}

.splash-brand .brand-logo-mark svg {
    width: 30px;
    height: 30px;
}
:root {
    --bg: #0c0c10;
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-card: rgba(30, 30, 38, 0.85);
    --bg-card-hover: rgba(45, 45, 58, 0.95);
    --border: rgba(255, 255, 255, 0.08);
    --text: #ffffff;
    --text-muted: #9ca3af;
    --accent: #ffffff;
    --orange: #f97316;
    --focus-bar: #ffffff;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(80, 60, 120, 0.15), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(40, 40, 60, 0.2), transparent 45%);
    pointer-events: none;
    z-index: 0;
}

a { color: inherit; text-decoration: none; }

.app-page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 2rem 1.5rem;
}

/* Home — exact 100vh, no page scroll */
html.home-body,
body.home-body {
    height: 100%;
    max-height: 100vh;
    overflow: hidden;
    margin: 0;
}

.app-page.home-screen {
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    overflow: hidden;
    padding: 1rem 2rem 0.75rem;
    box-sizing: border-box;
}

.home-screen .top-bar {
    margin-bottom: 0;
    flex-shrink: 0;
}

.home-screen .hero-main {
    flex: 1;
    min-height: 0;
    padding: 0.5rem 0;
    align-items: center;
}

.home-screen .hero-cards {
    align-items: center;
    height: 100%;
}

.home-screen .hero-card {
    width: 190px;
    height: min(360px, calc(100vh - 220px));
    min-height: 240px;
    max-height: 100%;
}

.home-screen .app-footer-brand {
    flex-shrink: 0;
    padding: 0.5rem 0 0.25rem;
}

.home-screen .clock-widget {
    bottom: 1.25rem;
    right: 1.5rem;
}

/* Header */
.top-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
}

.brand-mi {
    display: none;
}

.search-wrap {
    flex: 1;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
}

.search-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    color: white;
    font-size: 0.95rem;
    outline: none;
}

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

.mic-btn, .icon-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-glass);
    color: white;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.top-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-glass);
    color: white;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fecaca;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.95rem;
    border: 2px solid rgba(255,255,255,0.15);
}

/* Main hero cards (home) */
.hero-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0 2rem;
    min-height: 0;
}

.hero-cards {
    display: flex;
    gap: 1.25rem;
    align-items: stretch;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-card {
    position: relative;
    width: 200px;
    min-height: 380px;
    border-radius: 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 1.5rem 1rem 2rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    overflow: hidden;
}

.hero-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 3px;
    border-radius: 999px;
    background: transparent;
    transition: background 0.2s, box-shadow 0.2s;
}

.hero-card:hover,
.hero-card.is-active {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.18);
    box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}

.hero-card.is-active::after,
.hero-card:hover::after {
    background: var(--focus-bar);
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
}

.hero-card-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.hero-card-badge.right {
    left: auto;
    text-align: right;
}

.hero-card-badge.orange {
    color: var(--orange);
    font-weight: 600;
}

.hero-card-icon {
    width: 72px;
    height: 72px;
    opacity: 0.9;
}

.hero-card-icon svg {
    width: 100%;
    height: 100%;
    stroke: white;
    fill: none;
    stroke-width: 1.5;
}

.hero-card-title {
    font-size: 1.35rem;
    font-weight: 600;
    text-align: center;
}

.hero-card-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* Clock widget */
.clock-widget {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    text-align: right;
    z-index: 10;
}

.clock-weather {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.clock-time {
    font-size: 2.75rem;
    font-weight: 300;
    line-height: 1;
    letter-spacing: -0.02em;
}

.clock-date {
    margin-top: 0.35rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Category & list pages */
.page-content {
    flex: 1;
    padding-bottom: 5rem;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
}

.page-head h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

.page-head p {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-glass);
    font-size: 0.9rem;
    white-space: nowrap;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.category-tile {
    min-height: 140px;
    padding: 1.25rem;
    border-radius: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s, border-color 0.15s;
}

.category-tile:hover {
    transform: translateY(-3px);
    border-color: rgba(255,255,255,0.2);
}

.category-tile h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.3;
}

.category-tile span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.stream-card {
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.15s;
}

.stream-card:hover {
    transform: scale(1.02);
    border-color: rgba(255,255,255,0.15);
}

.stream-poster {
    aspect-ratio: 2/3;
    background: #15151c;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.stream-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stream-poster.live {
    aspect-ratio: 16/10;
}

.stream-poster span {
    font-size: 2rem;
    opacity: 0.35;
}

.stream-info {
    padding: 0.75rem 0.85rem 0.9rem;
}

.stream-info h3 {
    margin: 0 0 0.25rem;
    font-size: 0.85rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stream-info p {
    margin: 0 0 0.45rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stream-info a {
    font-size: 0.75rem;
    color: #93c5fd;
    font-weight: 600;
}

.alert-error {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fecaca;
    font-size: 0.9rem;
}

/* Login */
.login-page body, body.login-page {
    display: grid;
    place-items: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.25rem 2rem;
    border-radius: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
}

.login-card h1 {
    margin: 1rem 0 0.25rem;
    text-align: center;
}

.login-card > p {
    margin: 0 0 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.3);
    color: white;
    font-size: 0.95rem;
    outline: none;
}

.form-group input:focus {
    border-color: rgba(255,255,255,0.25);
}

.btn-login {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.9rem;
    border: none;
    border-radius: 12px;
    background: white;
    color: #111;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn-login:hover { filter: brightness(0.95); }

.hidden { display: none !important; }

@media (max-width: 768px) {
    .app-page { padding: 1rem; }
    .top-bar { flex-wrap: wrap; }
    .search-wrap { order: 3; max-width: 100%; width: 100%; }
    .hero-card { width: 160px; min-height: 320px; }
    .clock-widget { right: 1rem; bottom: 1rem; }
    .clock-time { font-size: 2rem; }
}
