/* ===== Open Studio — Application Styles ===== */

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    color: #1a1a1a;
    background: #f8f9fa;
    line-height: 1.5;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.3;
}

a {
    color: #378ADD;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Buttons --- */
button, .btn {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.btn-primary {
    background: #378ADD;
    color: #fff;
}

.btn-primary:hover {
    background: #2b73b8;
}

.btn-secondary {
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

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

button:disabled, .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Inputs & Form Elements --- */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="number"],
input[type="time"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #1a1a1a;
    width: 100%;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #378ADD;
    box-shadow: 0 0 0 3px rgba(55, 138, 221, 0.12);
}

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 4px;
}

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

textarea {
    resize: vertical;
    min-height: 80px;
}

/* --- Header --- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #475569;
}

.user-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
}

.logout-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.logout-btn:hover {
    color: #D85A30;
    background: #fef2f2;
}

/* --- Onboarding Banner --- */
.onboarding-banner {
    background: #E6F1FB;
    border: 1px solid #378ADD;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    color: #1e3a5f;
    line-height: 1.6;
}

.onboarding-banner.hidden {
    display: none;
}

.onboarding-banner-text {
    flex: 1;
}

.onboarding-dismiss {
    background: none;
    border: none;
    font-size: 20px;
    color: #378ADD;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

.onboarding-dismiss:hover {
    color: #1e3a5f;
}

/* --- Group Section Headers --- */
.room-group {
    margin-bottom: 28px;
}

.room-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    padding-left: 2px;
}

/* --- Room Card Grid --- */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* --- Room Card --- */
.room-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.15s, border-color 0.15s;
}

.room-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

/* Card sizing by occupancy */
.room-card.size-empty {
    min-height: 120px;
}

.room-card.size-1 {
    min-height: 150px;
}

.room-card.size-2-3 {
    min-height: 190px;
}

.room-card.size-4-5 {
    min-height: 230px;
}

.room-card.size-6plus {
    min-height: 270px;
}

/* --- Card Header Row --- */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Type Badges (colored pills) --- */
.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.type-badge.dropin {
    background: #e6f7f1;
    color: #1D9E75;
}

.type-badge.standup {
    background: #fdf3e0;
    color: #b87a0f;
}

.type-badge.demo {
    background: #eeedf9;
    color: #7F77DD;
}

.type-badge.session {
    background: #e8f1fb;
    color: #378ADD;
}

/* --- Mode Dots --- */
.mode-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mode-dot.open {
    background: #22c55e;
}

.mode-dot.dnd {
    background: #eab308;
}

.mode-dot.knock {
    background: #ef4444;
}

/* --- Status Line --- */
.card-status {
    font-size: 12px;
    color: #64748b;
    font-style: italic;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Avatar Row --- */
.avatar-row {
    display: flex;
    align-items: center;
    padding-left: 4px;
}

.avatar-row .avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    background: #e2e8f0;
    margin-left: -8px;
    flex-shrink: 0;
}

.avatar-row .avatar:first-child {
    margin-left: 0;
}

.avatar-row .avatar-overflow {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #f1f5f9;
    margin-left: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    flex-shrink: 0;
}

/* --- Screen Share Indicator --- */
.screen-share-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #378ADD;
    font-weight: 500;
}

.screen-share-indicator svg {
    width: 14px;
    height: 14px;
}

/* --- Card Footer / Entry Buttons --- */
.card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.entry-btn {
    background: #378ADD;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.entry-btn:hover {
    background: #2b73b8;
}

.entry-btn.knock {
    background: #fff;
    color: #D85A30;
    border: 1px solid #D85A30;
}

.entry-btn.knock:hover {
    background: #fef2f2;
}

/* --- Modal Overlay --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
}

.modal-close:hover {
    color: #475569;
    background: #f1f5f9;
}

.modal-body {
    padding: 20px 24px 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* --- Type Selector (step 1) --- */
.type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.type-option {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.type-option:hover {
    border-color: #cbd5e1;
}

.type-option.selected {
    border-color: #378ADD;
    box-shadow: 0 0 0 3px rgba(55, 138, 221, 0.12);
}

.type-option-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.type-option-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.type-option-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

/* --- Teammate Chips --- */
.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 12px;
    color: #475569;
}

.chip-remove {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
}

.chip-remove:hover {
    color: #D85A30;
}

/* --- Autocomplete Dropdown --- */
.autocomplete-wrap {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    margin-top: 4px;
}

.autocomplete-dropdown.hidden {
    display: none;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
}

.autocomplete-item:hover {
    background: #f1f5f9;
}

.autocomplete-item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
}

/* --- Room View — Bottom Bar --- */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 100;
}

.bottom-bar .bar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    color: #475569;
}

.bottom-bar .bar-btn:hover {
    background: #e2e8f0;
}

.bottom-bar .bar-btn.active {
    background: #378ADD;
    border-color: #378ADD;
    color: #fff;
}

.bottom-bar .bar-btn.danger {
    background: #D85A30;
    border-color: #D85A30;
    color: #fff;
}

.bottom-bar .bar-btn.danger:hover {
    background: #b84c28;
}

.bottom-bar .bar-btn svg {
    width: 20px;
    height: 20px;
}

/* --- Room View Layout --- */
.room-layout {
    display: flex;
    gap: 16px;
    height: calc(100vh - 140px);
    padding-bottom: 70px; /* space for bottom bar */
}

.room-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.room-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    overflow-y: auto;
}

.screen-share-area {
    flex: 1;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 14px;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
    font-size: 14px;
}

.empty-state p {
    margin-top: 8px;
}

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #378ADD;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

.text-muted {
    color: #64748b;
}

.text-sm {
    font-size: 13px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #app {
        padding: 16px;
    }

    .header {
        flex-wrap: wrap;
        gap: 12px;
    }

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

    .type-selector {
        grid-template-columns: 1fr;
    }

    .room-layout {
        flex-direction: column;
        height: auto;
    }

    .room-sidebar {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 18px;
    }

    .user-info .user-name {
        display: none;
    }
}
