@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

:root {
    --bg-main: #0a0c10;
    --bg-card: #151921;
    --bg-input: #1c212b;
    --border: #2d343f;
    --text-primary: #f0f2f5;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --success: #10b981;
    --shadow-card: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --radius: 12px;
}

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

body {
    background: radial-gradient(circle at 50% 0%, #1a1f2e 0%, #0a0c10 100%);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.nav-link i {
    width: 18px;
    height: 18px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

/* Tab Buttons */
.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    opacity: 0.8;
}

.tab-btn:hover {
    color: var(--text-primary);
    opacity: 1;
    background: rgba(255, 255, 255, 0.03);
    /* Very subtle hover */
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    opacity: 1;
    background: transparent;
    /* Clean look */
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 -4px 12px rgba(59, 130, 246, 0.5);
    /* Glow effect */
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2.5rem 3rem;
    width: calc(100% - 260px);
    max-width: 1600px;
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
}

h1 {
    font-size: 1.875rem;
    color: #fff;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

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

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

.btn-secondary {
    background-color: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border);
}

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

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

/* Grid */
.stream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.stream-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.stream-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
    border-color: var(--accent);
}

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-live,
.badge-online {
    background-color: var(--success);
    color: white;
}

.badge-connecting {
    background-color: #fbbf24;
    color: #000;
}

.badge-offline {
    background-color: var(--border);
    color: var(--text-secondary);
}

/* Utilities */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mt-4 {
    margin-top: 1rem;
}

/* Modals & Forms */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.error-msg {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    display: none;
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Redesigned Form Inputs */
.form-input,
.modal-input,
select.form-input,
textarea.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    -webkit-appearance: none;
    appearance: none;
}

select.form-input {
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
}

.form-input:hover,
.modal-input:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.form-input:focus,
.modal-input:focus {
    outline: none;
    border-color: var(--accent);
    background: #232936;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-input::placeholder,
.modal-input::placeholder {
    color: #4b5563;
}

.form-input[readonly],
.modal-input[readonly] {
    cursor: default;
    background: rgba(28, 33, 43, 0.5);
    color: var(--text-secondary);
}

/* Input Groups (Input + Button) */
.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.input-group .form-input,
.input-group .modal-input {
    flex: 1;
}

.copy-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--border);
    color: white;
    border-color: var(--accent);
}

.copy-btn i {
    width: 18px;
    height: 18px;
}

/* Specific to Admin Access List */
.stream-access-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
}

.stream-access-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

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

/* Analytics Stats Grid */
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1rem;
}

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

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}

.stat-icon-wrapper.resolution {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.stat-icon-wrapper.codecs {
    background: rgba(236, 72, 153, 0.1);
    color: #ec4899;
}

.stat-icon-wrapper.health {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

/* Live Button (Refined Integrated Style) */
.live-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 0 12px;
    height: 28px;
    border-radius: 14px;
    /* Pill shape */
    font-size: 0.65rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.08em;
    font-family: inherit;
    margin-right: 8px;
    align-self: center;
}

.live-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.live-btn.on-air {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}

.live-btn .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    transition: transform 0.2s;
}

.live-btn.on-air .dot {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    animation: live-pulse-smooth 2s infinite ease-in-out;
}

@keyframes live-pulse-smooth {

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

    50% {
        transform: scale(1.3);
        opacity: 0.6;
    }
}

/* Mixer Dashboard Grid Optimizations */
.stream-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
}

.stream-card {
    border-color: rgba(255, 255, 255, 0.05);
    background: linear-gradient(135deg, var(--bg-card), rgba(255, 255, 255, 0.02));
}

.stream-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(59, 130, 246, 0.3);
}

.video-js {
    background-color: #000;
}

.video-js {
    background-color: #000;
}