/* Click to call widget style */
:root {
    color-scheme: light;
    --bg: #f7f9fc;
    --bg-band: #eef4f8;
    --surface: #ffffff;
    --surface-soft: #f5f8fb;
    --surface-strong: #ebf1f5;
    --text: #17212b;
    --text-muted: #667381;
    --border: #dbe4ec;
    --primary: #0f8f8c;
    --primary-dark: #096765;
    --primary-soft: #dff6f4;
    --accent: #ff7a1a;
    --accent-dark: #dc5f00;
    --danger: #e5484d;
    --danger-soft: #ffe8e8;
    --shadow: 0 22px 60px rgb(26 45 64 / 0.13);
    --shadow-soft: 0 10px 28px rgb(26 45 64 / 0.08);
    --radius-sm: 8px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --transition: 180ms ease;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background:
        linear-gradient(180deg, var(--bg-band) 0%, var(--bg) 42%, #ffffff 100%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgb(15 143 140 / 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgb(15 143 140 / 0.045) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(180deg, #000 0%, transparent 58%);
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
}

button,
input[type="button"],
select,
label {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
#c2c_keypad_table td:focus-visible {
    outline: 3px solid rgb(15 143 140 / 0.28);
    outline-offset: 3px;
}

.app-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 34px 0 44px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 44px;
}

.brand-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    width: 100%;
}

.brand-logo {
    display: flex;
    align-items: center;
    min-width: 0;
}

.brand-logo img {
    display: block;
    width: clamp(150px, 22vw, 270px);
    max-height: 72px;
    object-fit: contain;
}

.brand-logo-ac {
    justify-content: flex-end;
}

.brand-separator {
    flex: 1;
    min-width: 36px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.call-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(360px, 440px);
    gap: clamp(28px, 5vw, 72px);
    align-items: center;
}

.intro {
    max-width: 620px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid rgb(15 143 140 / 0.22);
    border-radius: 999px;
    background: rgb(255 255 255 / 0.72);
    color: var(--primary-dark);
    font-size: 0.88rem;
    font-weight: 700;
}

h1 {
    margin: 22px 0 16px;
    font-size: clamp(3rem, 7vw, 6.7rem);
    line-height: 0.95;
    letter-spacing: 0;
    color: var(--text);
}

p {
    margin: 0;
    max-width: 520px;
    color: var(--text-muted);
    font-size: clamp(1.05rem, 2.1vw, 1.45rem);
    line-height: 1.55;
}

.call-panel {
    width: 100%;
    min-width: 0;
    padding: clamp(22px, 3vw, 32px);
    border: 1px solid rgb(219 228 236 / 0.88);
    border-radius: var(--radius-lg);
    background: rgb(255 255 255 / 0.88);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

#c2c_connection_speed_div,
#c2c_test_call_quality_div {
    display: none;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 0.94rem;
    line-height: 1.35;
    text-align: center;
}

#c2c_test_call_quality_div:empty {
    display: none !important;
}

#c2c_widget_div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

#c2c_widget_div > button {
    min-height: 48px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text);
    background: var(--surface-soft);
    box-shadow: none;
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1;
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        background-color var(--transition),
        border-color var(--transition),
        color var(--transition);
}

#c2c_widget_div > button[style*="inline-block"] {
    display: inline-flex !important;
}

#c2c_widget_div > .c2c_widget_btn_wide {
    grid-column: 1 / -1;
    width: 100%;
}

#c2c_widget_div > button:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgb(15 143 140 / 0.2);
    background: #ffffff;
    box-shadow: var(--shadow-soft);
}

#c2c_widget_div > button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

#c2c_widget_div > button:disabled {
    cursor: not-allowed;
    color: #9aa7b3;
    background: #eef2f6;
    opacity: 0.8;
}

#c2c_widget_div svg {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    fill: currentColor;
    stroke: none;
}

#c2c_select_devices_svg path,
#c2c_keypad_svg path,
#c2c_call_svg path {
    fill: currentColor;
    stroke: none;
}

#c2c_test_svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#c2c_camera_svg rect,
#c2c_camera_svg polyline {
    fill: none;
    stroke: currentColor;
}

#c2c_select_devices_btn,
#c2c_keypad_btn,
#c2c_test_btn,
#c2c_camera_btn {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

#c2c_call_btn,
#c2c_widget_div > .c2c_call_btn_ready,
#c2c_widget_div > .c2c_call_btn_hangup {
    grid-column: 1 / -1;
    min-height: 78px;
    padding: 0 24px;
    color: #ffffff;
    background: var(--accent);
    border-color: rgb(255 122 26 / 0.18);
    box-shadow: 0 18px 34px rgb(255 122 26 / 0.25);
    font-size: clamp(1.35rem, 3.2vw, 2rem);
    font-weight: 800;
}

#c2c_call_btn > svg {
    width: 34px;
    height: 34px;
}

#c2c_call_btn:hover:not(:disabled),
#c2c_widget_div > .c2c_call_btn_ready:hover:not(:disabled) {
    background: var(--accent-dark);
    border-color: transparent;
    box-shadow: 0 22px 42px rgb(255 122 26 / 0.3);
}

#c2c_widget_div > .c2c_call_btn_hangup {
    background: var(--danger);
    box-shadow: 0 18px 34px rgb(229 72 77 / 0.22);
}

#c2c_widget_div > .c2c_call_btn_hangup:hover:not(:disabled) {
    background: #ca343a;
    box-shadow: 0 22px 42px rgb(229 72 77 / 0.28);
}

.c2c_call_svg_disabled {
    color: #97a3ae;
}

.c2c_call_svg_ready {
    transform: none;
}

.c2c_call_svg_hangup {
    transform: none;
}

.c2c_call_svg_calling {
    animation: c2cPulse 1.4s infinite ease-in-out;
}

@keyframes c2cPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.12);
        opacity: 0.78;
    }
}

.check-option {
    display: none;
    grid-column: 1 / -1;
    justify-self: center;
    color: var(--text-muted);
    font-size: 0.94rem;
    font-weight: 700;
}

.check-option[style*="inline-block"] {
    display: inline-flex !important;
}

.check-option label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 8px 18px rgb(26 45 64 / 0.07);
    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        background-color var(--transition);
}

.check-option label:hover {
    border-color: rgb(15 143 140 / 0.28);
    box-shadow: var(--shadow-soft);
}

.media-toggle {
    position: relative;
}

.media-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.toggle-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: #dbe4ec;
    transition: background-color var(--transition);
}

.toggle-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgb(26 45 64 / 0.22);
    transition: transform var(--transition);
}

.toggle-icon {
    display: inline-flex;
    color: var(--text-muted);
}

.toggle-icon svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toggle-text {
    color: var(--text-muted);
}

.media-toggle input:checked + .toggle-switch {
    background: var(--primary);
}

.media-toggle input:checked + .toggle-switch::after {
    transform: translateX(18px);
}

.media-toggle input:checked ~ .toggle-icon,
.media-toggle input:checked ~ .toggle-text {
    color: var(--primary-dark);
}

.media-toggle input:focus-visible + .toggle-switch {
    outline: 3px solid rgb(15 143 140 / 0.28);
    outline-offset: 3px;
}

#c2c_camera_btn {
    grid-column: 1 / -1;
    justify-self: center;
    width: 56px;
    padding: 0;
}

#c2c_camera_svg {
    width: 25px;
    height: 25px;
}

#c2c_camera_line_svg.c2c_camera_on {
    stroke: none !important;
}

#c2c_camera_line_svg.c2c_camera_off {
    stroke: currentColor !important;
}

#c2c_select_devices_div {
    display: none;
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 4px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    text-align: left;
}

#c2c_devices {
    display: grid;
    gap: 14px;
}

#c2c_devices fieldset {
    display: grid;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

#c2c_devices legend {
    margin-bottom: 4px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
}

.device-field {
    display: grid;
    gap: 7px;
}

.device-field label {
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.device-field select {
    width: 100%;
    min-height: 44px;
    padding: 0 38px 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: #ffffff;
}

.device-field select:disabled {
    color: #96a1ad;
    background: #f1f5f8;
    cursor: not-allowed;
}

#select_devices_done_btn {
    min-height: 46px;
    border: 0;
    border-radius: var(--radius-sm);
    color: #ffffff;
    background: var(--primary);
    cursor: pointer;
    font-weight: 800;
    transition:
        transform var(--transition),
        background-color var(--transition),
        box-shadow var(--transition);
}

#select_devices_done_btn:hover {
    transform: translateY(-1px);
    background: var(--primary-dark);
    box-shadow: var(--shadow-soft);
}

#c2c_status_line {
    grid-column: 1 / -1;
    min-height: 28px;
    margin-top: 4px;
    color: var(--primary-dark);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
}

.c2c_widget_disabled #c2c_status_line {
    color: var(--danger);
}

#c2c_keypad_div {
    display: none;
    margin-top: 18px;
}

#c2c_keypad_table {
    width: min(100%, 320px);
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 8px;
    table-layout: fixed;
    text-align: center;
}

#c2c_keypad_table td {
    width: 33.333%;
    height: 54px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface-soft);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 800;
    transition:
        transform var(--transition),
        background-color var(--transition),
        border-color var(--transition);
}

#c2c_keypad_table td:hover {
    transform: translateY(-1px);
    border-color: rgb(15 143 140 / 0.26);
    background: var(--primary-soft);
    color: var(--primary-dark);
}

#c2c_video_div {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

#c2c_video_div video {
    max-width: min(100%, 480px);
    border-radius: var(--radius-md);
    background: #101820;
    box-shadow: var(--shadow-soft);
}

a {
    color: var(--primary);
}

@media (max-width: 860px) {
    .app-shell {
        width: min(100% - 24px, 680px);
        padding: 24px 0 34px;
        gap: 34px;
    }

    .call-layout {
        grid-template-columns: 1fr;
        gap: 26px;
    }

    .intro {
        text-align: center;
        justify-self: center;
    }

    .intro p {
        margin: 0 auto;
    }
}

@media (max-width: 560px) {
    .app-shell {
        width: min(100% - 20px, 440px);
        padding-top: 18px;
        gap: 28px;
    }

    .brand-bar {
        gap: 12px;
    }

    .brand-logo img {
        width: clamp(118px, 38vw, 165px);
        max-height: 48px;
    }

    .brand-separator {
        min-width: 16px;
    }

    h1 {
        margin-top: 18px;
        font-size: clamp(2.7rem, 16vw, 4.4rem);
    }

    .call-panel {
        padding: 18px;
        border-radius: 22px;
    }

    #c2c_widget_div {
        grid-template-columns: 1fr;
    }

    #c2c_widget_div > button {
        min-height: 46px;
    }

    #c2c_call_btn,
    #c2c_widget_div > .c2c_call_btn_ready,
    #c2c_widget_div > .c2c_call_btn_hangup {
        min-height: 70px;
        font-size: 1.45rem;
    }

}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
