/* AYA-Connect — WebRTC zvonki (overlay + istorija). Palitra --aya-* (petrol/teal). */

/* ===== Polnoekrannyj overlay zvonka ===== */
.aya-call-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: none;
    background: linear-gradient(180deg, var(--aya-petrol, #005f6d) 0%, var(--aya-petrol-darkest, #062534) 100%);
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
}
.aya-call-overlay.aya-call-open {
    display: block;
}

.aya-call-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding-top: calc(env(safe-area-inset-top, 0px) + 48px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 36px);
    padding-left: calc(env(safe-area-inset-left, 0px) + 20px);
    padding-right: calc(env(safe-area-inset-right, 0px) + 20px);
    box-sizing: border-box;
}

/* ----- Verhnij blok: avatar / imja / status ----- */
.aya-call-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    margin-top: 6vh;
}
.aya-call-avatar {
    width: 124px;
    height: 124px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, .14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 54px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .35);
    border: 2px solid rgba(255, 255, 255, .18);
}
.aya-call-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.aya-call-name {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: .2px;
}
.aya-call-name-sm {
    font-size: 18px;
    font-weight: 600;
}
.aya-call-status {
    font-size: 16px;
    color: rgba(255, 255, 255, .78);
}
.aya-call-status::after {
    content: '';
    display: inline-block;
    width: 0;
    animation: aya-call-dots 1.4s steps(4, end) infinite;
}
@keyframes aya-call-dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}
.aya-call-timer {
    font-size: 17px;
    font-weight: 500;
    color: rgba(255, 255, 255, .9);
    font-variant-numeric: tabular-nums;
}

/* ----- Video ----- */
.aya-call-videoscreen {
    justify-content: flex-end;
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
}
.aya-call-video-wrap {
    position: absolute;
    inset: 0;
    background: #000;
}
.aya-call-remote-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}
.aya-call-local-video {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 16px);
    right: calc(env(safe-area-inset-right, 0px) + 16px);
    width: 102px;
    height: 152px;
    object-fit: cover;
    border-radius: 14px;
    background: #111;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .45);
    border: 1px solid rgba(255, 255, 255, .22);
    z-index: 2;
}
.aya-call-overlay-info {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 20px);
    left: calc(env(safe-area-inset-left, 0px) + 20px);
    z-index: 2;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ----- Panel upravlenija ----- */
.aya-call-controls {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 22px;
    width: 100%;
    margin-top: auto;
    position: relative;
    z-index: 3;
}
.aya-call-videoscreen .aya-call-controls {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
    background: linear-gradient(0deg, rgba(0, 0, 0, .45) 0%, rgba(0, 0, 0, 0) 100%);
    padding-top: 40px;
}
.aya-call-incoming-controls {
    gap: 64px;
}

.aya-call-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.aya-call-btn-ic {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .16);
    transition: background .15s ease, transform .1s ease;
}
.aya-call-btn:active .aya-call-btn-ic {
    transform: scale(.93);
}
.aya-call-btn-label {
    font-size: 12px;
    color: rgba(255, 255, 255, .82);
}

/* sostojanija instrumentov */
.aya-call-btn-tool.off .aya-call-btn-ic {
    background: #fff;
    color: var(--aya-petrol, #005f6d);
}
.aya-call-btn-speaker.on .aya-call-btn-ic,
#aya-call-speaker.on .aya-call-btn-ic {
    background: #fff;
    color: var(--aya-petrol, #005f6d);
}

/* zaversit / otklonit — krasnaja */
.aya-call-btn-end .aya-call-btn-ic {
    background: #e8502e;
    box-shadow: 0 6px 22px rgba(232, 80, 46, .45);
}
.aya-call-btn-end:active .aya-call-btn-ic {
    background: #c8421f;
}

/* prinjat — zeljonaja */
.aya-call-btn-accept .aya-call-btn-ic {
    background: #2faa55;
    box-shadow: 0 6px 22px rgba(47, 170, 85, .45);
}
.aya-call-btn-accept:active .aya-call-btn-ic {
    background: #258c45;
}

/* ===== Istorija zvonkov (vkladka) ===== */
.aya-call-hist {
    display: flex;
    flex-direction: column;
}
.aya-call-hist-loading {
    padding: 28px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
}
.aya-call-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, rgba(0, 0, 0, .06));
}
.aya-call-row-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    background: var(--aya-grey-bg, #eef0f2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--aya-grey2, #52606a);
}
.aya-call-row-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.aya-call-row-main {
    flex: 1 1 auto;
    min-width: 0;
}
.aya-call-row-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text, #1A1D21);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.aya-call-row-name.missed {
    color: #e8502e;
}
.aya-call-row-sub {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
    font-size: 14px;
    color: var(--text-secondary, #65676B);
}
.aya-call-dir-ic {
    display: inline-flex;
    align-items: center;
}
.aya-call-row-sub.out .aya-call-dir-ic {
    color: var(--aya-teal, #1a6b82);
    transform: rotate(45deg);
}
.aya-call-row-sub.in .aya-call-dir-ic {
    color: var(--aya-teal, #1a6b82);
}
.aya-call-row-sub.missed {
    color: #e8502e;
}
.aya-call-row-sub.missed .aya-call-dir-ic {
    color: #e8502e;
}
.aya-call-row-redial {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--aya-pill-active-bg, #cfe8db);
    color: var(--aya-teal, #1a6b82);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .1s ease, background .15s ease;
}
.aya-call-row-redial:active {
    transform: scale(.92);
}

/* Tjomnaja tema dlja istorii */
body.dark-theme .aya-call-row {
    border-bottom-color: var(--border, rgba(255, 255, 255, .08));
}
body.dark-theme .aya-call-row-redial {
    background: rgba(26, 107, 130, .28);
    color: #8fd4e4;
}
