/* 
 * StreamSync - Premium Dark Mode Web App Styles
 */

/* ================== CSS Variables ================== */
:root {
    --bg-base: #0a0a0c;
    --bg-surface: #141419;
    --bg-elevated: #1e1e24;

    --brand-primary: #6366f1;
    --brand-primary-hover: #4f46e5;

    --brand-secondary: #3b82f6;
    --brand-secondary-hover: #2563eb;

    --accent-danger: #ef4444;
    --accent-danger-hover: #dc2626;
    --accent-danger-bg: rgba(239, 68, 68, 0.1);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 9999px;

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ================== Global Reset ================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow: auto;
    min-height: 100vh;
}

/* ================== Layout Structure ================== */
.app-container {
    width: 100%;
    min-height: 100vh;
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--bg-base);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity var(--transition-fast), transform var(--transition-bounce), visibility var(--transition-fast);
    z-index: 10;
}

.view.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    z-index: 20;
}

.view.hidden {
    display: none;
}

/* ================== Typography ================== */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
}

p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.subtext {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* ================== Buttons ================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all var(--transition-fast);
    text-decoration: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.96);
}

.btn-large {
    width: 100%;
    padding: 24px 20px;
    flex-direction: column;
    border-radius: var(--radius-lg);
    gap: 8px;
}

.btn-large .icon {
    font-size: 2.5rem;
    margin-bottom: 4px;
}

.btn-large .text {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-hover));
    box-shadow: var(--shadow-glow);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

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

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

.btn-danger {
    background-color: var(--accent-danger);
    color: #fff;
}

.btn-outline.btn-danger {
    background: transparent;
    border: 1px solid var(--accent-danger);
    color: var(--accent-danger);
}

.btn-pill {
    border-radius: var(--radius-pill);
    padding: 16px 32px;
    font-size: 1.125rem;
    box-shadow: var(--shadow-md);
    gap: 12px;
}

.btn-sm {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    padding: 0;
}

/* ================== General Components ================== */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

.input-group input:focus {
    outline: none;
    border-color: var(--brand-primary);
}

/* ================== Specific Views ================== */

/* Home View */
.hero-header {
    margin-top: 10vh;
    margin-bottom: 48px;
    text-align: center;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-section {
    margin-top: auto;
    padding-bottom: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

/* Dashboard View */
.status-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.creation-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.creation-bar input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    color: #fff;
    font-size: 1rem;
}

.camera-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.camera-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.camera-info h4 {
    margin-bottom: 4px;
}

.camera-actions {
    display: flex;
    gap: 8px;
}

.sharing-management {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.sharing-management .input-group {
    flex-direction: row;
    margin-bottom: 16px;
}

.sharing-email-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sharing-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Streaming View */
.stream-backdrop {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
}

.live-indicator {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 10;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-danger);
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.camera-preview {
    width: 100%;
    height: 100%;
}

.camera-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.invite-overlay {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    z-index: 20;
    width: 140px;
    text-align: center;
}

#qrcode-small {
    background: #fff;
    padding: 6px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: inline-block;
}

#qrcode-small img,
#qrcode-small canvas {
    width: 110px !important;
    height: 110px !important;
}

.url-share-small .url-text {
    display: block;
    font-size: 0.65rem;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.stream-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding-bottom: 24px;
}

/* Fullscreen Monitor */
.monitor-full {
    background: #000;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.overlay-controls {
    position: absolute;
    bottom: 40px;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.live-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--accent-danger);
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: bold;
}

.hidden {
    display: none !important;
}

.empty-msg {
    text-align: center;
    color: var(--text-tertiary);
    padding: 48px 0;
}