/* CSS Variables - Phony.cam Design System */
:root {
    /* Surfaces */
    --bg: #000000;
    --bg-soft: #050505;
    --bg-elevated: #0a0a0a;
    
    /* Glass tints */
    --glass-1: rgba(255, 255, 255, 0.045);
    --glass-2: rgba(255, 255, 255, 0.07);
    --glass-3: rgba(255, 255, 255, 0.10);
    
    /* Glass rims */
    --rim: rgba(255, 255, 255, 0.10);
    --rim-strong: rgba(255, 255, 255, 0.18);
    --rim-bright: rgba(255, 255, 255, 0.32);
    
    /* Text */
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-muted: #6e6e73;
    --text-faint: rgba(245, 245, 247, 0.32);
    
    /* Accent - white gradient */
    --accent-gradient: linear-gradient(100deg, #ffffff 0%, #ffffff 40%, rgba(255,255,255,0.85) 50%, #ffffff 60%, #ffffff 100%);
    
    /* Status colors */
    --success: #00ff88;
    --warning: #ffaa00;
    --error: #ff4444;
    
    /* Geometry */
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    /* Shadows */
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 24px 48px -16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 32px 64px -24px rgba(0, 0, 0, 0.8);
    
    /* Liquid glass */
    --liquid: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.04), transparent 60%),
              radial-gradient(ellipse at 50% 100%, rgba(255,255,255,0.02), transparent 50%);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Login Screen */
.login-container {
    background: var(--glass-2);
    backdrop-filter: blur(32px);
    border: 1px solid var(--rim);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

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

.logo-section h1 {
    font-size: 36px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    background: var(--glass-1);
    border: 1px solid var(--rim);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text);
    font-size: 16px;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--rim-bright);
    background: var(--glass-2);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.error-message {
    color: var(--error);
    font-size: 14px;
    text-align: center;
    min-height: 20px;
}

/* Softphone Screen */
#softphone-screen {
    align-items: flex-start;
    padding-top: 20px;
}

.softphone-container {
    background: var(--glass-2);
    backdrop-filter: blur(32px);
    border: 1px solid var(--rim);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}

/* Header */
.softphone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--rim);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.status-indicator.online .status-dot {
    background: var(--success);
}

.status-indicator.calling .status-dot {
    background: var(--warning);
}

.status-indicator.in-call .status-dot {
    background: var(--accent-primary);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.user-login {
    font-size: 16px;
    color: var(--text);
    font-weight: 600;
}

.btn-icon {
    background: var(--glass-1);
    border: 1px solid var(--rim);
    border-radius: var(--radius-sm);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--glass-2);
    border-color: var(--rim-strong);
}

.btn-icon .icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

/* Call Info */
.call-info {
    text-align: center;
    margin-bottom: 24px;
    min-height: 80px;
}

.call-status {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.call-timer {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
}

.remote-number {
    font-size: 20px;
    color: var(--text);
    font-weight: 600;
}

/* Number Display */
.number-display {
    position: relative;
    margin-bottom: 24px;
}

#phone-number {
    width: 100%;
    background: var(--glass-1);
    border: 2px solid var(--rim);
    border-radius: var(--radius-md);
    padding: 20px 50px 20px 20px;
    color: var(--text);
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
    cursor: default;
}

#phone-number:focus {
    outline: none;
    border-color: var(--rim-bright);
    background: var(--glass-2);
}

.btn-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 32px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-clear:hover {
    background: var(--glass-2);
    color: var(--text);
}

/* Numpad */
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.numpad-btn {
    background: var(--glass-1);
    border: 1px solid var(--rim);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    min-height: 72px;
}

.numpad-btn:hover {
    background: var(--glass-2);
    border-color: var(--rim-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.numpad-btn:active {
    transform: translateY(0);
    background: var(--glass-3);
}

.numpad-btn .digit {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.numpad-btn .letters {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 1px;
}

/* Call Controls */
.call-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.btn-call,
.btn-hangup {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-call {
    background: var(--text);
}

.btn-call:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.3);
}

.btn-call:active {
    transform: scale(1.05);
}

.btn-call .icon {
    width: 32px;
    height: 32px;
    filter: brightness(0);
}

.btn-hangup {
    background: var(--error);
    display: none;
}

.btn-hangup.active {
    display: flex;
}

.btn-hangup:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(255, 68, 68, 0.4);
}

.btn-hangup .icon {
    width: 32px;
    height: 32px;
    filter: brightness(0) invert(1);
}

.additional-controls {
    display: none;
    gap: 16px;
    justify-content: center;
}

.additional-controls.active {
    display: flex;
}

.btn-control {
    background: var(--glass-1);
    border: 1px solid var(--rim);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 80px;
}

.btn-control:hover {
    background: var(--glass-2);
    border-color: var(--rim-strong);
}

.btn-control.active {
    background: var(--glass-3);
    border-color: var(--rim-bright);
}

.btn-control .icon {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

.btn-control span {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-control.active span {
    color: var(--text);
}

/* Debug Console */
.debug-console {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass-2);
    border-top: 1px solid var(--rim);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    backdrop-filter: blur(32px);
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    user-select: none;
}

.debug-header span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.debug-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.debug-console.collapsed .debug-toggle {
    transform: rotate(-90deg);
}

.debug-content {
    max-height: 200px;
    overflow-y: auto;
    padding: 16px 20px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    transition: var(--transition);
}

.debug-console.collapsed .debug-content {
    display: none;
}

.debug-content div {
    margin-bottom: 8px;
    padding: 8px 12px;
    background: var(--glass-1);
    border-radius: 6px;
    border-left: 3px solid var(--text);
}

.debug-content .error {
    border-left-color: var(--error);
    color: var(--error);
}

.debug-content .success {
    border-left-color: var(--success);
    color: var(--success);
}

.debug-content .warning {
    border-left-color: var(--warning);
    color: var(--warning);
}

/* Scrollbar Styling */
.debug-content::-webkit-scrollbar {
    width: 8px;
}

.debug-content::-webkit-scrollbar-track {
    background: var(--bg);
}

.debug-content::-webkit-scrollbar-thumb {
    background: var(--glass-2);
    border-radius: 4px;
}

.debug-content::-webkit-scrollbar-thumb:hover {
    background: var(--glass-3);
}

/* Responsive Design */
@media (max-width: 640px) {
    .screen {
        padding: 12px;
    }
    
    #softphone-screen {
        padding-top: 12px;
    }
    
    .softphone-container {
        padding: 20px 16px;
        border-radius: var(--radius-md);
    }
    
    .login-container {
        padding: 32px 24px;
        border-radius: var(--radius-md);
    }
    
    .softphone-header {
        margin-bottom: 24px;
        padding-bottom: 16px;
    }
    
    .user-login {
        font-size: 14px;
    }
    
    .btn-icon {
        width: 40px;
        height: 40px;
    }
    
    .call-info {
        min-height: 60px;
        margin-bottom: 16px;
    }
    
    .call-status {
        font-size: 16px;
    }
    
    .call-timer {
        font-size: 28px;
    }
    
    .remote-number {
        font-size: 18px;
    }
    
    .number-display {
        margin-bottom: 16px;
    }
    
    #phone-number {
        font-size: 20px;
        padding: 16px 40px 16px 16px;
        letter-spacing: 1px;
    }
    
    .numpad {
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .numpad-btn {
        min-height: 64px;
        padding: 16px 12px;
        border-radius: var(--radius-sm);
    }
    
    .numpad-btn .digit {
        font-size: 24px;
    }
    
    .numpad-btn .letters {
        font-size: 10px;
    }
    
    .btn-call,
    .btn-hangup {
        width: 64px;
        height: 64px;
    }
    
    .btn-call .icon,
    .btn-hangup .icon {
        width: 28px;
        height: 28px;
    }
    
    .additional-controls {
        gap: 12px;
    }
    
    .btn-control {
        min-width: 70px;
        padding: 10px 16px;
    }
    
    .btn-control .icon {
        width: 20px;
        height: 20px;
    }
    
    .btn-control span {
        font-size: 11px;
    }
    
    .debug-content {
        max-height: 150px;
        font-size: 11px;
    }
}

@media (max-width: 380px) {
    .softphone-container {
        padding: 16px 12px;
    }
    
    .login-container {
        padding: 24px 20px;
    }
    
    #phone-number {
        font-size: 18px;
        padding: 14px 36px 14px 14px;
    }
    
    .numpad-btn {
        min-height: 56px;
        padding: 12px 8px;
    }
    
    .numpad-btn .digit {
        font-size: 22px;
    }
    
    .numpad-btn .letters {
        font-size: 9px;
    }
    
    .btn-call,
    .btn-hangup {
        width: 56px;
        height: 56px;
    }
    
    .btn-call .icon,
    .btn-hangup .icon {
        width: 24px;
        height: 24px;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .screen {
        padding: 8px;
    }
    
    #softphone-screen {
        padding-top: 8px;
    }
    
    .softphone-container {
        padding: 16px;
        max-width: 100%;
    }
    
    .softphone-header {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }
    
    .call-info {
        min-height: 40px;
        margin-bottom: 12px;
    }
    
    .call-timer {
        font-size: 24px;
    }
    
    .number-display {
        margin-bottom: 12px;
    }
    
    #phone-number {
        padding: 12px 36px 12px 12px;
        font-size: 18px;
    }
    
    .numpad {
        gap: 6px;
        margin-bottom: 12px;
    }
    
    .numpad-btn {
        min-height: 48px;
        padding: 10px;
    }
    
    .numpad-btn .digit {
        font-size: 20px;
    }
    
    .numpad-btn .letters {
        font-size: 8px;
    }
    
    .btn-call,
    .btn-hangup {
        width: 52px;
        height: 52px;
    }
}

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

.disabled {
    opacity: 0.5;
    pointer-events: none;
}
