/* ========================================
   Stream Platform - Main Stylesheet
   ======================================== */

:root {
    --bg-primary: #0e0e10;
    --bg-secondary: #18181b;
    --bg-tertiary: #1f1f23;
    --bg-hover: #26262c;
    --text-primary: #efeff1;
    --text-secondary: #adadb8;
    --text-muted: #848494;
    --accent: #9147ff;
    --accent-hover: #772ce8;
    --accent-light: #bf94ff;
    --online: #00e676;
    --danger: #eb0400;
    --border: #2f2f35;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

a {
    color: var(--accent-light);
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

/* ========== Navbar ========== */

.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand:hover {
    color: var(--accent);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ========== Buttons ========== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

/* ========== Cards ========== */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.card-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-thumbnail .live-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.card-thumbnail .viewer-count {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.card-body {
    padding: 12px;
    display: flex;
    gap: 10px;
}

.card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.card-info h3 {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.card-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.card-info .category {
    color: var(--accent-light);
    font-size: 0.75rem;
    margin-top: 4px;
}

/* ========== Stream Grid ========== */

.stream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 24px;
}

/* ========== Page Container ========== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding: 24px 24px 0;
}

/* ========== Live Page Layout ========== */

.live-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    height: calc(100vh - 56px);
}

.live-player {
    background: #000;
    display: flex;
    flex-direction: column;
}

.live-player video {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.live-info {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.live-info h2 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.live-info .streamer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.live-info .streamer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.live-info .streamer-name {
    font-weight: 600;
}

.live-info .streamer-category {
    font-size: 0.8rem;
    color: var(--accent-light);
}

/* ========== Chat Panel ========== */

.chat-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
}

.chat-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    text-align: center;
    font-size: 0.9rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-message {
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-message .author {
    font-weight: 700;
    color: var(--accent-light);
}

.chat-message.system {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
}

.chat-input-area {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.chat-input-area form {
    display: flex;
    gap: 8px;
}

.chat-input-area input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

.chat-input-area input:focus {
    border-color: var(--accent);
}

.chat-input-area button {
    padding: 10px 18px;
}

/* ========== Forms ========== */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px);
}

.auth-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-form h1 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.form-submit {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    font-size: 1rem;
}

.form-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.alert-error {
    background: rgba(235, 4, 0, 0.15);
    border: 1px solid var(--danger);
    color: #ff6b6b;
}

/* ========== Dashboard ========== */

.dashboard {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px;
}

.dashboard h1 {
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.dashboard-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.dashboard-card h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stream-key-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.stream-key-display input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

.stream-instructions {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.stream-instructions code {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--accent-light);
}

.stream-form .form-group {
    margin-bottom: 14px;
}

/* ========== Empty State ========== */

.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
}

.empty-state h2 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.95rem;
}

/* ========== Offline Player ========== */

.offline-screen {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: var(--text-muted);
}

.offline-screen .offline-icon {
    font-size: 3rem;
}

/* ========== Subscription Button ========== */

.btn-sub {
    background: var(--accent);
    color: white;
    padding: 8px 24px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sub:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-sub--active {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-sub--active:hover {
    background: rgba(235, 4, 0, 0.15);
    color: var(--danger);
    border-color: var(--danger);
}

.sub-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 8px;
}

.streamer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

/* ========== Subscriber List ========== */

.subscriber-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.subscriber-row:last-child {
    border-bottom: none;
}

.subscriber-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.subscriber-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.subscriber-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.subscriber-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.subscriber-live {
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ========== Responsive ========== */

@media (max-width: 768px) {
    .live-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chat-panel {
        height: 400px;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .stream-grid {
        grid-template-columns: 1fr;
    }
}
