/* main.css - Complete ZeroCall Styles with New Login Design */

/* =============================================
   LOGIN SCREEN - Premium Claymorphic Design
   ============================================= */

/* Font already loaded from Google Fonts in HTML */

:root {
    /* Light Gold and Green Soft Background Gradient */
    --bg-gradient: linear-gradient(135deg, #f3eed8 0%, #dae5d9 100%);
    --card-bg: #fbfbfa;
    --text-dark: #3a3b3c;
    --text-muted: #8c8d8e;
    /* Button Gradient matching the theme */
    --btn-gradient: linear-gradient(90deg, #c5aa76 0%, #9cb99c 100%);
    --shadow-soft: 0 20px 40px rgba(0, 0, 0, 0.05);
    --clay-inset: inset 2px 2px 5px rgba(255, 255, 255, 0.8), inset -2px -2px 5px rgba(0, 0, 0, 0.03);
    --clay-outset: 3px 3px 6px rgba(0, 0, 0, 0.04), -3px -3px 6px rgba(255, 255, 255, 0.9);
}

/* --- Login Screen Override --- */
#loginScreen {
    background: #eeecd9;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    overflow-x: hidden;
}

.login-wrapper {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin-top: 180px; /* Gives upper illustration ample breathing room */
}

/* --- Header Illustration Layer --- */
.illustration-container {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    z-index: 2;
    pointer-events: none;
	margin-top:-50px;
}

.illustration-container img {
    width: 110%;
    height: auto;
    display: block;
	margin-top:20px;
	margin-left:-2px;
}

/* --- Main Claymorphic Card --- */
.login-card {
    background: white;
    border-radius: 40px;
    padding: 55px 35px 35px 35px;
    box-shadow: 2px 2px 2px 5px rgba(199,199,199,0.1);
    border: 1px solid rgba(255, 255, 255, 1);
    text-align: center;
    position: relative;
    z-index: 1;
	margin-top:260px;
}

/* --- Typography --- */
.login-card h2 {
    color: var(--text-dark);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-card .subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 30px;
}

/* --- Form Inputs --- */
.input-group {
    position: relative;
    margin-bottom: 16px;
}

.input-group i.input-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    z-index: 1;
}

.input-group i.toggle-password {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    z-index: 1;
    transition: color 0.3s ease;
}

.input-group i.toggle-password:hover {
    color: var(--text-dark);
}

.input-group input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    border: none;
    background: #f2f3ef;
    border-radius: 25px;
    font-size: 14px;
    color: var(--text-dark);
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.04), inset -2px -2px 5px rgba(255,255,255,0.8);
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.input-group input::placeholder {
    color: #b5b6b2;
}

.input-group input:focus {
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.08), 0 0 0 2px rgba(156, 184, 156, 0.4);
}

/* --- Forgot Password Link --- */
.forgot-password {
    display: block;
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    margin-top: -6px;
    margin-bottom: 24px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: var(--text-dark);
}

/* --- Primary Action Button --- */
.login-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 25px;
    background: var(--btn-gradient);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(156, 184, 156, 0.25), var(--clay-inset);
    transition: transform 0.2s ease, opacity 0.2s ease;
    font-family: 'Poppins', sans-serif;
}

.login-btn:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(1px);
}

/* --- Divider --- */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin: 24px 0;
    font-weight: 400;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e3de;
}

.divider:not(:empty)::before {
    margin-right: .75em;
}
.divider:not(:empty)::after {
    margin-left: .75em;
}

/* --- Social Login Icons --- */
.social-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.social-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: #fdfdfb;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    box-shadow: var(--clay-outset);
    border: 1px solid rgba(255,255,255,0.8);
    transition: transform 0.2s ease;
}

.social-btn:hover {
    transform: scale(1.05);
}

.social-btn img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

/* --- Footer Links --- */
.footer-text {
    font-size: 13px;
    color: var(--text-muted);
}

.footer-text a {
    color: #6177b9;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
}

.footer-text a:hover {
    text-decoration: underline;
}

/* --- Error Message --- */
.error-msg {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 12px;
    min-height: 20px;
}

.hidden {
    display: none !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .illustration-container {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    z-index: 2;
    pointer-events: none;
	margin-top:-10px;
}

.illustration-container img {
    width: 110%;
    height: auto;
    display: block;
	margin-top:50px;
	margin-left:-1px;
}

    .login-wrapper {
        margin-top: 220px;
    }

    .login-card {
        padding: 40px 25px 30px 25px;
        border-radius: 32px;
		margin-top:125px;
    }

    .login-card h2 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .illustration-container {
        top: -175px;
        width: 120%;
    }

    .login-wrapper {
        margin-top: 130px;
    }

    .login-card {
        padding: 32px 20px 25px 20px;
        border-radius: 28px;
    }

    .login-card h2 {
        font-size: 22px;
    }

    .social-btn {
        width: 48px;
        height: 48px;
    }

    .social-btn img {
        width: 18px;
        height: 18px;
    }

    .social-group {
        gap: 12px;
    }
}

/* =============================================
   END OF LOGIN STYLES
   ============================================= */

/* --- CSS Variables --- */
:root {
    --primary: #6C63FF;
    --primary-dark: #5a52d5;
    --primary-light: #8b83ff;
    --secondary: #2D2B55;
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1a2744;
    --text-light: #e0e0e0;
    --text-muted: #8892b0;
    --success: #4CAF50;
    --danger: #ff4757;
    --warning: #ffa502;
    --info: #4a9eff;
    --border-radius: 16px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    position: relative;
}

/* --- Screen Management --- */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: none;
    flex-direction: column;
    background: var(--bg-dark);
    z-index: 10;
    transition: opacity 0.4s ease;
}

.screen.active {
    display: flex;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes ring {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

@keyframes float2 {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(-5deg); }
}

@keyframes float3 {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-8px) scale(1.1); }
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* --- LOGIN SCREEN - New Design --- */
#loginScreen {
    background: #efedd8;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 30px 28px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(108, 99, 255, 0.12);
    border: 1px solid rgba(108, 99, 255, 0.06);
}

/* Illustration Section */
.illustration-section {
    margin-bottom: 28px;
    text-align: center;
}

.illustration-wrapper {
    position: relative;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.illustration-content {
    position: relative;
    width: 100%;
    max-width: 280px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* People avatars */
.person {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.person i {
    font-size: 52px;
    color: #6C63FF;
    filter: drop-shadow(0 4px 12px rgba(108, 99, 255, 0.2));
    transition: transform 0.3s ease;
}

.person-left {
    left: 5%;
    animation: float 3s ease-in-out infinite;
}

.person-right {
    right: 5%;
    animation: float2 3.5s ease-in-out infinite;
}

.person .label {
    font-size: 10px;
    color: #6C63FF;
    font-weight: 600;
    background: rgba(108, 99, 255, 0.1);
    padding: 2px 10px;
    border-radius: 12px;
}

.thought-bubble {
    position: absolute;
    top: -18px;
    right: -25px;
    background: #ffffff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    animation: pulse-ring 2s ease-in-out infinite;
}

.thought-bubble i {
    font-size: 14px;
    color: #ffa502;
}

.call-icon {
    position: absolute;
    bottom: -8px;
    right: -20px;
    background: #4CAF50;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(76, 175, 80, 0.3);
}

.call-icon i {
    font-size: 13px;
    color: white;
}

/* Connection line between people */
.connection-line {
    position: absolute;
    top: 50%;
    left: 25%;
    width: 50%;
    height: 2px;
    background: linear-gradient(90deg, #6C63FF, #a29bfe, #6C63FF);
    transform: translateY(-50%);
    border-radius: 2px;
    opacity: 0.3;
}

.connection-line::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    width: 8px;
    height: 8px;
    background: #6C63FF;
    border-radius: 50%;
    transform: translateX(-50%);
    animation: pulse-ring 2s ease-in-out infinite;
}

/* Floating icons */
.floating-icon {
    position: absolute;
    font-size: 18px;
    color: #6C63FF;
    background: #ffffff;
    padding: 8px;
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(108, 99, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-icon i {
    font-size: 16px;
    color: #6C63FF;
}

.icon1 {
    top: 5%;
    left: 35%;
    animation: float 4s ease-in-out infinite;
}

.icon2 {
    bottom: 5%;
    right: 30%;
    animation: float2 3.5s ease-in-out infinite;
    color: #ffa502;
}

.icon2 i {
    color: #ffa502;
}

.icon3 {
    top: 10%;
    right: 35%;
    animation: float3 4.5s ease-in-out infinite;
    color: #4CAF50;
}

.icon3 i {
    color: #4CAF50;
}

/* Welcome Section */
.welcome-section {
    text-align: left;
    margin-bottom: 28px;
}

.welcome-section h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    -webkit-text-fill-color: #1a1a2e;
    background: none;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.welcome-section p {
    color: #6b6b8a;
    font-size: 15px;
    margin-top: 0;
    font-weight: 400;
}

/* Input Groups with Icons */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group .input-icon {
    position: absolute;
    left: 14px;
    color: #9a9ab0;
    font-size: 16px;
    transition: color 0.3s ease;
    pointer-events: none;
}

.input-group input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: #f4f4f9;
    border: 2px solid transparent;
    border-radius: 14px;
    color: #1a1a2e;
    font-size: 15px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    outline: none;
}

.input-group input:focus {
    border-color: #6C63FF;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.08);
}

.input-group input:focus ~ .input-icon,
.input-group input:focus + .input-icon {
    color: #6C63FF;
}

.input-group input::placeholder {
    color: #a8a8c0;
}

/* Forgot Password */
.forgot-password {
    text-align: right;
    margin: -4px 0 22px 0;
}

.forgot-password a {
    color: #6C63FF;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.forgot-password a:hover {
    color: #5a52d5;
    text-decoration: underline;
}

/* Login Button */
.btn-primary {
    width: 100%;
    padding: 15px;
    background: #6C63FF;
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    margin-top: 4px;
    letter-spacing: 0.3px;
}

.btn-primary:hover {
    background: #5a52d5;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 99, 255, 0.35);
}

.btn-primary:active {
    transform: translateY(0px);
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.25);
}

/* Sign Up Link */
.signup-link {
    text-align: center;
    margin-top: 18px;
    color: #6b6b8a;
    font-size: 14px;
}

.signup-link a {
    color: #6C63FF;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
}

.signup-link a:hover {
    color: #5a52d5;
    text-decoration: underline;
}

/* Error Message */
.error-msg {
    color: #ff4757;
    font-size: 14px;
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
}

/* Hide forms */
.hidden {
    display: none !important;
}

/* --- User List Screen --- */
#userListScreen {
    background: var(--bg-dark);
}

.app-header {
    background: var(--bg-card);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    min-height: 70px;
    z-index: 15;
}

.app-header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-header .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

.app-header .user-details h3 {
    font-size: 16px;
    font-weight: 600;
}

.app-header .user-details small {
    color: var(--text-muted);
    font-size: 12px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-actions button {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-light);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-actions button:hover, .header-actions button:active {
    background: rgba(255, 255, 255, 0.1);
}

.user-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 80px;
    -webkit-overflow-scrolling: touch;
}

.user-list-container::-webkit-scrollbar {
    width: 4px;
}

.user-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.user-list-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.user-card {
    background: var(--bg-card);
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    border: 1px solid transparent;
}

.user-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(108, 99, 255, 0.2);
}

.user-card.offline {
    opacity: 0.5;
}

.user-card .user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
    margin-right: 14px;
}

.user-card .user-info {
    flex: 1;
    min-width: 0;
}

.user-card .user-name {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-card .user-status {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--text-muted); }
.status-dot.busy { background: var(--warning); }
.status-dot.in_call { background: var(--danger); }

.user-card .action-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.user-card .action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    position: relative;
}

.user-card .action-btn:active {
    transform: scale(0.9);
}

.user-card .action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.action-btn.video-call {
    background: var(--primary);
    color: white;
}

.action-btn.video-call:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.action-btn.audio-call {
    background: var(--info);
    color: white;
}

.action-btn.audio-call:hover:not(:disabled) {
    background: #3a8ce5;
    transform: translateY(-2px);
}

.action-btn.chat-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.action-btn.chat-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.action-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* --- Call Screen --- */
#callScreen {
    background: #000;
    z-index: 20;
}

#remoteVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    z-index: 1;
}

.call-type-badge {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    background: rgba(0,0,0,0.6);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.local-video-wrapper {
    position: absolute;
    bottom: 120px;
    right: 16px;
    width: 140px;
    height: 105px;
    border-radius: 14px;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 5;
    cursor: grab;
    touch-action: none;
    transition: width 0.3s ease, height 0.3s ease;
}

.local-video-wrapper:active {
    cursor: grabbing;
}

.local-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
}

.call-info {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    text-align: center;
    pointer-events: none;
}

.call-info h3 {
    font-size: 20px;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.call-info .call-status {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.call-info .call-status .status-dots {
    display: inline-flex;
    gap: 4px;
}

.call-info .call-status .status-dots span {
    width: 6px;
    height: 6px;
    background: var(--warning);
    border-radius: 50%;
    animation: dotBounce 1.4s infinite ease-in-out both;
}

.call-info .call-status .status-dots span:nth-child(1) { animation-delay: -0.32s; }
.call-info .call-status .status-dots span:nth-child(2) { animation-delay: -0.16s; }
.call-info .call-status .status-dots span:nth-child(3) { animation-delay: 0s; }

.call-info .call-timer {
    font-size: 16px;
    font-weight: 300;
    color: rgba(255,255,255,0.8);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

.call-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 5;
    padding: 0 10px;
    width: 100%;
    max-width: 500px;
    justify-content: center;
}

.call-controls .ctrl-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    font-size: 22px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    touch-action: manipulation;
    flex-shrink: 0;
}

.call-controls .ctrl-btn:active {
    transform: scale(0.9);
}

.call-controls .ctrl-btn.end-call {
    background: var(--danger);
    box-shadow: 0 4px 20px rgba(255, 71, 87, 0.4);
}

.call-controls .ctrl-btn.end-call:active {
    box-shadow: 0 2px 10px rgba(255, 71, 87, 0.2);
}

.call-controls .ctrl-btn.mute-btn.active {
    background: var(--warning);
}

.call-controls .ctrl-btn.video-btn.active {
    background: var(--warning);
}

.call-controls .ctrl-btn.switch-btn {
    background: var(--primary);
}

/* Audio call - hide video and show waveform */
.call-screen.audio-only #remoteVideo {
    display: none;
}

.call-screen.audio-only .audio-wave {
    display: flex !important;
}

.audio-wave {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    gap: 6px;
    align-items: center;
    height: 60px;
}

.audio-wave .bar {
    width: 6px;
    background: var(--primary);
    border-radius: 3px;
    animation: wave 1.2s ease-in-out infinite;
}

.audio-wave .bar:nth-child(1) { animation-delay: 0s; height: 20px; }
.audio-wave .bar:nth-child(2) { animation-delay: 0.2s; height: 40px; }
.audio-wave .bar:nth-child(3) { animation-delay: 0.4s; height: 60px; }
.audio-wave .bar:nth-child(4) { animation-delay: 0.6s; height: 45px; }
.audio-wave .bar:nth-child(5) { animation-delay: 0.8s; height: 30px; }
.audio-wave .bar:nth-child(6) { animation-delay: 1.0s; height: 50px; }
.audio-wave .bar:nth-child(7) { animation-delay: 0.3s; height: 25px; }
.audio-wave .bar:nth-child(8) { animation-delay: 0.7s; height: 55px; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* --- Chat Screen --- */
#chatScreen {
    z-index: 15;
    background: var(--bg-dark);
}

.chat-header {
    background: var(--bg-card);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    min-height: 60px;
}

.chat-header .back-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    transition: var(--transition);
    touch-action: manipulation;
}

.chat-header .back-btn:active {
    transform: scale(0.9);
}

.chat-header .chat-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.chat-header .chat-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.chat-header .chat-user-name {
    font-size: 16px;
    font-weight: 600;
}

.chat-header .chat-user-status {
    font-size: 12px;
    color: var(--text-muted);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 80px;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.chat-messages .message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 8px;
    word-wrap: break-word;
    animation: bounceIn 0.3s ease;
}

.chat-messages .message.sent {
    background: var(--primary);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-messages .message.received {
    background: var(--bg-card);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-messages .message .msg-time {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
    display: block;
}

.chat-messages .message.received .msg-time {
    color: var(--text-muted);
}

.chat-messages .message .msg-status {
    font-size: 10px;
    margin-left: 4px;
    color: rgba(255,255,255,0.4);
}

.chat-messages .message.received .msg-status {
    color: var(--text-muted);
}

.chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: var(--bg-card);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    color: var(--text-light);
    font-size: 15px;
    outline: none;
    transition: var(--transition);
}

.chat-input-area input:focus {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.05);
}

.chat-input-area input::placeholder {
    color: var(--text-muted);
}

.chat-input-area .send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
}

.chat-input-area .send-btn:active {
    transform: scale(0.9);
}

.chat-input-area .send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-input-area .attach-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
}

.chat-input-area .attach-btn:hover:not(:disabled) {
    background: rgba(108, 99, 255, 0.15);
    color: var(--primary);
}

.chat-input-area .attach-btn:active {
    transform: scale(0.9);
}

.chat-input-area .attach-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Typing Indicator --- */
.chat-messages .typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
}

.chat-messages .typing-indicator .typing-text {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.chat-messages .typing-indicator .typing-dots {
    display: inline-flex;
    gap: 3px;
}

.chat-messages .typing-indicator .typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.2s infinite ease-in-out;
}

.chat-messages .typing-indicator .typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.chat-messages .typing-indicator .typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* --- Chat Attachments --- */
.msg-attachment {
    display: block;
    text-decoration: none;
    color: inherit;
    margin-bottom: 6px;
    outline: none;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.msg-attachment:focus,
.msg-attachment:active {
    outline: none;
}

.msg-attachment-image img {
    max-width: 100%;
    max-height: 260px;
    border-radius: 10px;
    display: block;
    object-fit: cover;
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.msg-attachment-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

.msg-attachment-file i {
    font-size: 22px;
    color: var(--primary);
    flex-shrink: 0;
}

.msg-attachment-file .attachment-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.msg-attachment-file .attachment-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.msg-attachment-file .attachment-size {
    font-size: 11px;
    color: var(--text-muted);
}

/* --- Incoming Call Modal --- */
.incoming-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.incoming-modal.active {
    display: flex;
}

.incoming-card {
    background: var(--bg-card);
    padding: 40px 30px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 380px;
    width: 100%;
    border: 1px solid rgba(108, 99, 255, 0.2);
    animation: pulse 1.5s infinite;
}

.incoming-card .caller-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: white;
    margin: 0 auto 16px;
    box-shadow: 0 8px 30px rgba(108, 99, 255, 0.3);
}

.incoming-card h3 {
    font-size: 22px;
    font-weight: 600;
}

.incoming-card .caller-name {
    font-size: 18px;
    color: var(--text-muted);
    margin-top: 4px;
}

.incoming-card .call-type-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 4px 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 20px;
    display: inline-block;
}

.incoming-card .ringing-icon {
    font-size: 30px;
    color: var(--success);
    margin: 16px 0;
    animation: ring 1s infinite;
}

.incoming-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.incoming-actions button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    font-size: 26px;
    cursor: pointer;
    transition: var(--transition);
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
}

.incoming-actions button:active {
    transform: scale(0.9);
}

.incoming-actions .accept-btn {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.4);
}

.incoming-actions .reject-btn {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 20px rgba(255, 71, 87, 0.4);
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: var(--bg-card);
    color: var(--text-light);
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    animation: slideDown 0.4s ease;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.warning {
    border-left-color: var(--warning);
}

/* --- Utilities --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

.reconnecting {
    color: var(--warning) !important;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .login-container {
        padding: 24px 20px;
    }
    
    .welcome-section h1 {
        font-size: 24px;
    }
    
    .welcome-section p {
        font-size: 14px;
    }
    
    .input-group input {
        padding: 13px 16px 13px 40px;
        font-size: 14px;
    }
    
    .btn-primary {
        padding: 14px;
        font-size: 15px;
    }
    
    .illustration-wrapper {
        height: 110px;
    }
    
    .person i {
        font-size: 42px;
    }
    
    .floating-icon {
        font-size: 14px;
        padding: 6px;
    }
    
    .floating-icon i {
        font-size: 12px;
    }
    
    .app-header { padding: 12px 16px; min-height: 60px; }
    .user-list-container { padding: 12px 14px 100px; }
    .user-card { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
    .user-card .user-avatar { width: 38px; height: 38px; font-size: 15px; margin-right: 10px; }
    .user-card .action-buttons { gap: 4px; }
    .user-card .action-btn { width: 32px; height: 32px; font-size: 12px; }
    .local-video-wrapper { width: 110px; height: 82px; bottom: 100px; right: 12px; border-radius: 12px; }
    .call-controls { gap: 14px; bottom: 20px; }
    .call-controls .ctrl-btn { width: 50px; height: 50px; font-size: 18px; }
    .call-info { top: 20px; }
    .call-info h3 { font-size: 17px; }
    .incoming-card { padding: 30px 20px; }
    .incoming-card .caller-avatar { width: 64px; height: 64px; font-size: 28px; }
    .incoming-actions button { width: 52px; height: 52px; font-size: 22px; }
    .chat-messages { padding: 12px 12px 80px; }
    .chat-messages .message { max-width: 90%; }
    .chat-input-area { padding: 10px 12px; }
    .chat-input-area input { font-size: 14px; padding: 10px 14px; }
    .chat-input-area .send-btn { width: 42px; height: 42px; font-size: 16px; }
    .chat-input-area .attach-btn { width: 40px; height: 40px; font-size: 15px; }
    .audio-wave .bar { width: 4px; }
}

@media (min-width: 768px) {
    .login-container {
        padding: 40px 36px;
        border-radius: 28px;
    }
    
    .local-video-wrapper { width: 200px; height: 150px; bottom: 140px; right: 30px; }
    .call-controls .ctrl-btn { width: 64px; height: 64px; font-size: 26px; }
    .user-list-container { max-width: 600px; margin: 0 auto; }
}

@media (orientation: landscape) and (max-height: 500px) {
    .local-video-wrapper { width: 100px; height: 75px; bottom: 80px; right: 10px; }
    .call-controls { bottom: 10px; gap: 12px; }
    .call-controls .ctrl-btn { width: 44px; height: 44px; font-size: 16px; }
    .call-info { top: 10px; }
    .call-info h3 { font-size: 15px; }
}