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

:root {
    --primary-dark: #182825;
    --secondary-dark: #223531;
    --cream-cta: #ead0b5;
    --cream-hover: #e0c4a6;
    --bg-light: #f7f7f4;
    --white: #ffffff;
    --text-dark: #182825;
    --text-light: #f7f7f4;
    --text-muted: #5f6a66;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --success: #38bdf8;
    --error: #f43f5e;
    --warning: #f59e0b;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.5;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--primary-dark);
}

a {
    color: var(--primary-dark);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.85;
}

/* Layout Elements */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Navigation */
header.app-header {
    background-color: var(--primary-dark);
    color: var(--text-light);
    padding: 15px 0;
    border-bottom: 1px solid var(--secondary-dark);
}

header.app-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header.app-header .logo-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

header.app-header h1 {
    font-size: 20px;
    color: var(--white);
    letter-spacing: -0.5px;
}

header.app-header h1 span {
    color: var(--cream-cta);
}

header.app-header nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
    align-items: center;
}

header.app-header nav a {
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
}

header.app-header nav a.active {
    color: var(--cream-cta);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--cream-cta);
    color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--cream-hover);
    transform: translateY(-1px);
    opacity: 1;
}

.btn-secondary {
    background-color: var(--white);
    color: var(--primary-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-light);
    border-color: var(--text-muted);
    opacity: 1;
}

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

.btn-dark:hover {
    background-color: var(--secondary-dark);
    opacity: 1;
}

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

.btn-danger:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: var(--radius-md);
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-dark);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(24, 40, 37, 0.08);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-dark);
    cursor: pointer;
}

/* Cards */
.card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 30px;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.card-title {
    font-size: 18px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 20px;
}

table.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

table.table th {
    background-color: var(--bg-light);
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

table.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

table.table tr:last-child td {
    border-bottom: none;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #dcfce7;
}

.alert-danger {
    background-color: #fff1f2;
    color: #9f1239;
    border: 1px solid #ffe4e6;
}

/* Login/Install Wizard Layout */
.centered-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background-color: var(--primary-dark);
}

.centered-layout-card {
    width: 100%;
    max-width: 500px;
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.centered-layout-logo {
    text-align: center;
    margin-bottom: 30px;
}

.centered-layout-logo h1 {
    font-size: 26px;
    letter-spacing: -0.5px;
}

.centered-layout-logo h1 span {
    color: var(--primary-dark);
}

.centered-layout-logo p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 5px;
}

/* Dashboard Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 30px;
}

@media (min-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-top: 40px;
}

.welcome-section h2 {
    font-size: 28px;
    letter-spacing: -0.5px;
}

.welcome-section p {
    color: var(--text-muted);
}

/* Meeting Details List */
.meeting-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.meeting-list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.meeting-list-info h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.meeting-list-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 50px;
}

.badge-live {
    background-color: #f0fdf4;
    color: #166534;
}

.badge-scheduled {
    background-color: #eff6ff;
    color: #1e40af;
}

.badge-ended {
    background-color: var(--bg-light);
    color: var(--text-muted);
}

.badge-canceled {
    background-color: #fff1f2;
    color: #9f1239;
}


/* Meeting Room Grid & Immersive Styles */
.meeting-room-body {
    background-color: #0b1211;
    color: #f8fafc;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.meeting-room-header {
    height: 60px;
    background-color: #131e1c;
    border-bottom: 1px solid #1c2e2b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
}

.meeting-room-header .room-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--white);
}

.meeting-room-header .room-meta {
    font-size: 13px;
    color: #8b9d99;
}

.meeting-room-main {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

.stage-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0b1211;
    position: relative;
    padding: 20px;
}

.video-grid {
    display: grid;
    gap: 15px;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-content: center;
    transition: all 0.3s ease;
}

/* Grid helper classes based on participant count */
.grid-1 { grid-template-columns: 1fr; max-width: 900px; max-height: 550px; }
.grid-2 { grid-template-columns: 1fr 1fr; max-width: 1000px; max-height: 400px; }
.grid-3-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; max-width: 1000px; max-height: 650px; }
.grid-5-6 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; max-width: 1100px; max-height: 650px; }
.grid-many { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.video-cell {
    position: relative;
    background-color: #131e1c;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16/9;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 2px solid #1c2e2b;
}

.video-cell.active-speaker {
    border-color: var(--cream-cta);
    box-shadow: 0 0 10px rgba(234, 208, 181, 0.4);
}

.video-cell.screen-share-cell {
    border-color: #38bdf8;
}

.video-cell video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-cell.screen-share-cell video {
    object-fit: contain;
    background-color: #000;
}

.video-cell .participant-name {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: rgba(19, 30, 28, 0.75);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--white);
    font-weight: 500;
    backdrop-filter: blur(4px);
}

.video-cell .status-icons {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.status-icon {
    background-color: rgba(19, 30, 28, 0.75);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--white);
    backdrop-filter: blur(4px);
}

.status-icon.muted {
    background-color: rgba(244, 63, 94, 0.85);
}

/* Sidebar Panel */
.room-sidebar {
    width: 320px;
    background-color: #131e1c;
    border-left: 1px solid #1c2e2b;
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: transform 0.3s ease;
}

.room-sidebar.hidden {
    display: none;
}

.sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid #1c2e2b;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 15px;
    color: var(--white);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.participant-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #1c2e2b;
}

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

.participant-row .name {
    font-size: 14px;
    color: #e2e8f0;
}

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

/* Controls Bar */
.controls-bar {
    height: 75px;
    background-color: #131e1c;
    border-top: 1px solid #1c2e2b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    z-index: 10;
}

.control-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.control-btn {
    background-color: #223531;
    color: #e2e8f0;
    border: 1px solid #2d4540;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background-color: #2e4a44;
    color: var(--white);
    border-color: #3e6059;
}

.control-btn.active {
    background-color: var(--cream-cta);
    color: var(--primary-dark);
    border-color: var(--cream-cta);
}

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

.control-btn.danger:hover {
    opacity: 0.9;
}

.control-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.control-btn-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    color: #8b9d99;
    cursor: pointer;
}

.control-btn-label:hover .control-btn {
    background-color: #2e4a44;
    color: var(--white);
}

.control-btn-label:hover span {
    color: var(--white);
}

.control-btn-label span {
    margin-top: 4px;
    transition: color 0.2s;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(11, 18, 17, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal-container {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    color: var(--text-dark);
    position: relative;
}

.modal-dark {
    background-color: #131e1c;
    border: 1px solid #1c2e2b;
    color: #e2e8f0;
}

.modal-dark h3 {
    color: var(--white);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 20px;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-dark .modal-close:hover {
    color: var(--white);
}

/* Invite Copy Block */
.copy-block {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    font-family: monospace;
    font-size: 13px;
    white-space: pre-wrap;
    margin-bottom: 15px;
    max-height: 180px;
    overflow-y: auto;
    color: var(--text-dark);
}

.modal-dark .copy-block {
    background-color: #0b1211;
    border-color: #1c2e2b;
    color: #e2e8f0;
}

/* Status Banner */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.active { background-color: var(--success); }
.status-dot.inactive { background-color: var(--text-muted); }

/* Avatar Placeholder */
.avatar-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: var(--secondary-dark);
    color: var(--cream-cta);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 600;
    margin: 0 auto 20px;
    border: 2px solid var(--cream-cta);
}

/* Guest Join Screen */
.guest-join-card {
    text-align: center;
}

.guest-join-options {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.guest-join-option-btn {
    flex: 1;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.guest-join-option-btn:hover {
    border-color: var(--primary-dark);
    background-color: var(--bg-light);
}

.guest-join-option-btn.active {
    border-color: var(--primary-dark);
    background-color: rgba(24, 40, 37, 0.05);
}

.guest-join-option-btn svg {
    width: 24px;
    height: 24px;
}

/* Waiting Room */
.waiting-room-container {
    text-align: center;
    padding: 40px 20px;
}

.waiting-spinner {
    border: 4px solid rgba(234, 208, 181, 0.25);
    border-top: 4px solid var(--cream-cta);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Impersonation Banner */
.impersonation-banner {
    background-color: var(--warning);
    color: var(--primary-dark);
    padding: 8px 20px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.impersonation-banner a {
    color: var(--primary-dark);
    text-decoration: underline;
    font-weight: 700;
}

/* Logo helper */
.tenant-logo-preview {
    max-height: 40px;
    max-width: 150px;
    object-fit: contain;
}

.logo-display {
    max-height: 50px;
    max-width: 180px;
    object-fit: contain;
}

/* Screen sharing active state */
.stage-area.screen-sharing-active {
    position: relative;
}

#screen-share-stage {
    background-color: #000000;
    border-radius: var(--radius-md);
    overflow: hidden;
}

#screen-share-stage video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stage-area.screen-sharing-active #video-grid {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    flex-direction: row !important;
    gap: 10px;
    width: auto !important;
    height: 110px !important;
    max-width: 90%;
    overflow-x: auto;
    z-index: 10;
    background-color: rgba(19, 30, 28, 0.7);
    padding: 10px;
    border-radius: var(--radius-md);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-lg);
    border: 1px solid #1c2e2b;
    justify-content: center;
    align-content: center;
}

.stage-area.screen-sharing-active #video-grid .video-cell {
    width: 140px !important;
    height: 78px !important; /* 16:9 ratio */
    aspect-ratio: 16/9;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    border-width: 1px;
}

.stage-area.screen-sharing-active #video-grid .video-cell .participant-name {
    font-size: 10px;
    padding: 2px 6px;
    bottom: 5px;
    left: 5px;
}

.stage-area.screen-sharing-active #video-grid .video-cell .status-icons {
    top: 5px;
    right: 5px;
}

.stage-area.screen-sharing-active #video-grid .video-cell .status-icon {
    width: 18px;
    height: 18px;
    font-size: 8px;
}
