:root {
    --primary: #4CAF50;
    --primary-hover: #45a049;
    --danger: #f44336;
    --danger-hover: #d32f2f;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #e0e6ed;
    --status-online: #4CAF50;
    --status-busy: #ff9800;
    
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 16px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* App-like feel */
}

/* App Container (Mobile size restriction on desktop) */
#app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background-color: var(--bg-color);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

@media (min-width: 481px) {
    #app-container {
        height: 85vh;
        max-height: 850px;
        border-radius: var(--radius-lg);
    }
}

/* Screen Management */
.screen, .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s ease, transform 0.3s ease;
    background-color: var(--bg-color);
    overflow-y: auto;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Home Screen */
#screen-home {
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    justify-content: center;
}

.logo-container {
    text-align: center;
    margin-bottom: 40px;
}

.logo-container h1 {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 5px;
}

.logo-container p {
    color: var(--text-muted);
}

.form-container {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.btn-primary {
    width: 100%;
    padding: 16px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Room Dashboard */
#screen-room {
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.btn-text {
    background: none;
    border: none;
    color: var(--danger);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
}

.room-actions {
    margin-bottom: 24px;
}

/* Diagnostic Tools */
.diagnostic-tools {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #eee;
    text-align: center;
}

.status-msg {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
}

.offline-dot {
    background-color: #9e9e9e;
}

.user-status-label {
    font-size: 11px;
    color: #888;
}

.room-id-tag {
    font-size: 14px;
    color: #4CAF50;
    font-weight: bold;
    margin-top: -4px;
}

.btn-text-only {
    background: none;
    border: none;
    color: #888;
    text-decoration: underline;
    font-size: 12px;
    margin-top: 16px;
    cursor: pointer;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--primary);
    border: 1px dashed var(--primary);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
}

.users-list h3 {
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-list {
    list-style: none;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.status-dot.online { background-color: var(--status-online); }
.status-dot.busy { background-color: var(--status-busy); }

.user-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.btn-call {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
}

.btn-call:disabled {
    background-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

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

.empty-state .small {
    font-size: 0.85rem;
    margin-top: 8px;
}

/* Incoming Call Overlay */
.overlay {
    background-color: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.call-dialog {
    background: var(--card-bg);
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    text-align: center;
    width: 90%;
    max-width: 350px;
}

.ring-animation {
    width: 80px;
    height: 80px;
    background-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: ring 1.5s infinite;
}

@keyframes ring {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(76, 175, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

.caller-info h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.caller-info p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.call-actions {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

/* Active Call Screen */
.bg-dark {
    background-color: #1a1a1a !important;
    color: white;
}

#screen-call {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 20px;
    z-index: 50;
}

.call-header {
    text-align: center;
}

.call-header h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.status-text {
    color: #aaaaaa;
    font-size: 1.1rem;
}

.timer {
    font-variant-numeric: tabular-nums;
    font-size: 1.2rem;
}

.call-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.avatar-large {
    width: 150px;
    height: 150px;
    background-color: #333;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    color: white;
}

.avatar-large.pulsing {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(255, 255, 255, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.call-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding-bottom: 20px;
}

.btn-round {
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, filter 0.2s;
}

.btn-round:active {
    transform: scale(0.95);
}

.btn-green { background-color: var(--primary); color: white; padding: 15px 30px; font-size: 1.1rem; }
.btn-red { background-color: var(--danger); color: white; padding: 15px 30px; font-size: 1.1rem; }
.btn-gray { background-color: #444; color: white; padding: 15px 30px; font-size: 1.1rem; }

.btn-large {
    padding: 20px 40px;
    font-size: 1.2rem;
}

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