:root {
    --bg-color: #0d1117;
    --glass-bg: rgba(22, 27, 34, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent: #4A9EFF;
    --accent-hover: #6BB0FF;
    --danger: #da3633;
    --danger-hover: #f85149;
    --keypad-bg: rgba(48, 54, 61, 0.4);
    --keypad-hover: rgba(48, 54, 61, 0.8);
    --input-bg: rgba(13, 17, 23, 0.6);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 0%, #1f2428 0%, #0d1117 100%);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    position: relative;
    /* For absolute top nav */
}

/* Top Nav */
.top-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: rgba(13, 17, 23, 0.8);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    box-sizing: border-box;
    z-index: 100;
}

.nav-brand {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: default;
}

.nav-user {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.logout-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
}

.phone-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    /* Auto width to fit content, but min width */
    min-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    user-select: none;
}

/* Header */
.header {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.logo {
    font-weight: 700;
    letter-spacing: -0.5px;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.phone-logo {
    max-height: 90px;
    height: auto;
    display: block;
    transition: all 0.3s ease;
}

.phone-logo.calling {
    animation: float 3s ease-in-out infinite, pulse-glow 2s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 5px rgba(74, 158, 255, 0.3));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(74, 158, 255, 0.8));
    }
}

/* Display */
.display-screen {
    width: 100%;
    margin-bottom: 2rem;
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
}

.status-text {
    font-size: 0.9rem;
    color: var(--accent);
    min-height: 1.2em;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.phone-input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    width: 100%;
    text-align: center;
    outline: none;
    font-weight: 300;
    letter-spacing: 2px;
}

.wave-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wave-canvas.active {
    opacity: 0.6;
}

.phone-input::placeholder {
    color: #30363d;
}

/* Keypad + Settings Wrapper */
.keypad-area {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: stretch;
    /* Match height */
}

/* Keypad Grid */
.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}

.key-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: var(--keypad-bg);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key-btn:hover {
    background: var(--keypad-hover);
    transform: scale(1.05);
}

.key-btn:active {
    transform: scale(0.95);
}

/* Settings Panel (Side) */
.settings-panel {
    display: flex;
    flex-direction: column;
    width: 200px;
    /* Fixed width for settings */
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    justify-content: center;
}

.settings-header {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.input-row {
    margin-bottom: 1.2rem;
}

.input-row label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    margin-left: 0.2rem;
}

.input-row input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 0.6rem;
    border-radius: 8px;
    color: var(--text-primary);
    box-sizing: border-box;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.input-row input:focus {
    border-color: var(--accent);
    outline: none;
}

.voice-effect-select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 0.6rem;
    border-radius: 8px;
    color: var(--text-primary);
    box-sizing: border-box;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    cursor: pointer;
}

.voice-effect-select:focus {
    border-color: var(--accent);
    outline: none;
}

.voice-effect-select option {
    background: var(--bg-color);
    color: var(--text-primary);
}


/* Controls */
.control-bar {
    display: flex;
    gap: 2rem;
    justify-content: center;
    width: 100%;
}

.action-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.5rem;
    /* Icon size */
}

.call-btn {
    background-color: var(--accent);
    color: white;
}

.call-btn:hover {
    background-color: var(--accent-hover);
}

.hangup-btn {
    background-color: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(218, 54, 51, 0.4);
}

.hangup-btn:hover {
    background-color: var(--danger-hover);
    box-shadow: 0 6px 16px rgba(218, 54, 51, 0.6);
}

.mute-btn {
    background-color: #555;
    color: white;
}

.mute-btn:hover {
    background-color: #666;
}

.mute-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.hangup-btn:disabled,
.call-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
}

/* Main Layout Wrapper */
.main-wrapper {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    justify-content: center;
}

/* Independent Logs Panel */
.independent-logs-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    width: 250px;
    height: 500px;
    /* Match approximate height of phone */
    display: flex;
    flex-direction: column;
}

.logs-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
}

/* Call Logs List */
.call-logs {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.log-item {
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
    padding: 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-left: 3px solid var(--accent);
}

.log-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.log-details {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
}

.log-duration {
    color: var(--accent);
}

/* Animations */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Hover effect for clickable log items */
.log-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
    transition: all 0.2s ease;
}

.log-item {
    transition: all 0.2s ease;
}

/* Favorites Panel */
.favorites-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    width: 250px;
    height: 500px;
    display: flex;
    flex-direction: column;
}

.favorites-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
}

.favorites-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.favorite-item {
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
    padding: 0.8rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--accent);
    transition: all 0.2s ease;
}

.favorite-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.favorite-info {
    flex: 1;
    cursor: pointer;
}

.favorite-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.favorite-number {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.delete-favorite-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.delete-favorite-btn:hover {
    opacity: 1;
}

.add-favorite-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.favorite-input {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 0.6rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.favorite-input:focus {
    border-color: var(--accent);
    outline: none;
}

.add-favorite-btn {
    background: var(--accent);
    border: none;
    color: white;
    padding: 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.add-favorite-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* Search Bar */
.search-bar {
    margin-bottom: 0.75rem;
}

.history-search-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 0.6rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.history-search-input:focus {
    border-color: var(--accent);
    outline: none;
}

.history-search-input::placeholder {
    color: var(--text-secondary);
}