/* ============================================
   OMAS SPRACHFREUND – CSS
   High-contrast, extra-large, accessible
   ============================================ */

/* ---- CSS Variables ---- */
:root {
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-lighter: #232344;
    --accent: #e94560;
    --accent-glow: rgba(233, 69, 96, 0.4);
    --accent-light: #ff6b81;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --success: #2ed573;
    --error: #ff4757;
    --border-radius: 20px;
    --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    background: var(--bg-dark);
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
}

/* ---- Screens ---- */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, transform 0.5s ease;
    z-index: 1;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    z-index: 0;
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px 30px;
    width: 100%;
    max-width: 500px;
}

.login-icon {
    font-size: 80px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

.login-title {
    font-size: 52px;
    font-weight: 900;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* ---- PIN Display ---- */
.pin-display {
    display: flex;
    gap: 18px;
    margin: 10px 0;
}

.pin-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid var(--text-muted);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-dot.filled {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.2);
    box-shadow: 0 0 20px var(--accent-glow);
}

.pin-dot.error {
    border-color: var(--error);
    background: var(--error);
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

.pin-error {
    font-size: 20px;
    font-weight: 700;
    color: var(--error);
    min-height: 30px;
    text-align: center;
}

/* ---- Numpad ---- */
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 360px;
}

.numpad-btn {
    height: 80px;
    font-size: 36px;
    font-weight: 800;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-card);
    border: 2px solid var(--bg-card-lighter);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.numpad-btn:active {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(0.93);
}

.numpad-btn:disabled {
    opacity: 0;
    cursor: default;
}

.numpad-delete {
    font-size: 32px;
    background: var(--bg-card-lighter);
}

.numpad-delete:active {
    background: var(--error);
    border-color: var(--error);
}

/* ============================================
   MAIN SCREEN
   ============================================ */
.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    padding: 30px;
    padding-top: env(safe-area-inset-top, 30px);
    padding-bottom: env(safe-area-inset-bottom, 30px);
}

/* ---- Status Bar ---- */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 0;
}

.status-greeting {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-secondary);
}

.logout-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--bg-card);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.logout-btn:active {
    opacity: 1;
}

/* ---- Talk Area ---- */
.talk-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 40px;
}

/* ---- Talk Button ---- */
.talk-button {
    position: relative;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, var(--accent), #c0392b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 10px 40px var(--accent-glow),
        0 0 80px rgba(233, 69, 96, 0.15),
        inset 0 -4px 12px rgba(0, 0, 0, 0.2);
}

.talk-button:active {
    transform: scale(0.92);
    box-shadow:
        0 5px 20px var(--accent-glow),
        inset 0 -2px 8px rgba(0, 0, 0, 0.3);
}

.talk-button.active {
    background: linear-gradient(145deg, var(--success), #1e9c52);
    box-shadow:
        0 10px 40px rgba(46, 213, 115, 0.4),
        0 0 80px rgba(46, 213, 115, 0.15),
        inset 0 -4px 12px rgba(0, 0, 0, 0.2);
}

.talk-button-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 2;
}

.talk-icon {
    font-size: 90px;
    line-height: 1;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

.talk-text {
    font-size: 34px;
    font-weight: 900;
    color: white;
    text-align: center;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ---- Pulse Animation ---- */
.pulse-ring {
    position: absolute;
    inset: -15px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    opacity: 0;
    animation: none;
}

.talk-button.active .pulse-ring {
    animation: pulse 2s cubic-bezier(0, 0, 0.2, 1) infinite;
    border-color: var(--success);
}

.pulse-ring-2 {
    animation-delay: 1s !important;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ---- Talk Hint ---- */
.talk-hint {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    max-width: 400px;
    line-height: 1.4;
}

.talk-hint.active {
    color: var(--success);
}

/* ---- ElevenLabs Container ---- */
.elevenlabs-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    background: linear-gradient(to top, var(--bg-dark), transparent);
    z-index: 10;
    transition: opacity 0.3s ease;
}

.elevenlabs-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.stop-button {
    width: 100%;
    max-width: 500px;
    padding: 24px 40px;
    font-size: 26px;
    font-weight: 800;
    font-family: var(--font);
    color: white;
    background: linear-gradient(145deg, #555, #333);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stop-button:active {
    background: var(--error);
    transform: scale(0.96);
}

/* ============================================
   RESPONSIVE – Tablet (Galaxy Tab S9)
   ============================================ */
@media (min-width: 700px) {
    .login-icon {
        font-size: 100px;
    }

    .login-title {
        font-size: 68px;
    }

    .login-subtitle {
        font-size: 30px;
    }

    .pin-dot {
        width: 36px;
        height: 36px;
    }

    .numpad {
        max-width: 440px;
        gap: 16px;
    }

    .numpad-btn {
        height: 96px;
        font-size: 42px;
    }

    .talk-button {
        width: 450px;
        height: 450px;
    }

    .talk-icon {
        font-size: 96px;
    }

    .talk-text {
        font-size: 36px;
    }

    .talk-hint {
        font-size: 30px;
    }

    .status-greeting {
        font-size: 34px;
    }

    .stop-button {
        font-size: 30px;
        padding: 28px 50px;
    }
}

/* Extra large tablets / landscape */
@media (min-width: 1000px) {
    .talk-button {
        width: 500px;
        height: 500px;
    }

    .talk-icon {
        font-size: 110px;
    }

    .talk-text {
        font-size: 42px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-container>* {
    animation: fadeIn 0.6s ease backwards;
}

.login-container>*:nth-child(1) {
    animation-delay: 0.1s;
}

.login-container>*:nth-child(2) {
    animation-delay: 0.2s;
}

.login-container>*:nth-child(3) {
    animation-delay: 0.3s;
}

.login-container>*:nth-child(4) {
    animation-delay: 0.4s;
}

.login-container>*:nth-child(5) {
    animation-delay: 0.5s;
}

.login-container>*:nth-child(6) {
    animation-delay: 0.6s;
}

/* ---- Loading Spinner (for widget loading) ---- */
.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--bg-card-lighter);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

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