/* ============================================
   Spark247Bot - iOS/Telegram Mini App Style
   (adapted from Flex24/7Bot / Amazon example)
   ============================================ */

:root {
    --bg-primary: #f2f2f7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #000000;
    --text-secondary: #8e8e93;
    --text-tertiary: #c7c7cc;
    --accent-blue: #007aff;
    --accent-green: #34c759;
    --accent-red: #ff3b30;
    --accent-orange: #ff9500;
    --border-color: rgba(60, 60, 67, 0.1);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-elevated: 0 4px 16px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-2xl: 24px;
    --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    min-height: 100vh;
    padding: var(--spacing-lg);
    padding-bottom: 100px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 0;
    border: none;
    border-radius: 0;
    background-color: transparent;
    box-shadow: none;
    width: 100%;
}

h1 {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.5px;
}

hr {
    display: none;
}

.welcome-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-card);
}

.welcome-section p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
    color: var(--text-secondary);
}

.welcome-section p:last-child {
    border-bottom: none;
}

.welcome-section p b {
    color: var(--text-primary);
    font-weight: 500;
}

.subtitle {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: var(--spacing-xl) 0 var(--spacing-sm) var(--spacing-lg);
    padding: 0;
}

h2.subtitle:first-of-type {
    margin-top: 0;
}

.section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-card);
}

.section > p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.input-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: nowrap;
    gap: var(--spacing-sm);
}

.input-container:last-child,
.input-container:last-of-type {
    border-bottom: none;
}

.input-label {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 4px;
    border: 1.5px solid var(--accent-blue);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1;
    color: var(--accent-blue);
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    vertical-align: middle;
}

.info-icon:hover {
    opacity: 1;
}

.input-field,
.input-field-2 {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    font-size: 16px;
    font-family: var(--font-family);
    color: var(--text-primary);
    outline: none;
    transition: background 0.2s ease;
}

.input-field:focus,
.input-field-2:focus {
    background: rgba(0, 122, 255, 0.08);
}

.small-input-field {
    width: 70px;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    font-size: 16px;
    font-family: var(--font-family);
    color: var(--text-primary);
    text-align: center;
    outline: none;
}

select {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    font-size: 15px;
    font-family: var(--font-family);
    color: var(--accent-blue);
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23007AFF' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.offer-term-input {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
}

.range-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.range-label-inline {
    font-size: 14px;
    color: var(--text-secondary);
    min-width: 30px;
}

.time-input-button {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 20px;
    font-weight: 400;
    color: var(--accent-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.time-input-button:hover {
    background: rgba(0, 122, 255, 0.1);
}

.time-input-button:active {
    transform: scale(0.95);
    background: rgba(0, 122, 255, 0.2);
}

.time-input-container {
    display: flex;
    align-items: flex-start;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
    gap: var(--spacing-md);
}

.time-input-container:last-of-type {
    border-bottom: none;
}

.iphone-checkbox {
    -webkit-appearance: none;
    appearance: none;
    width: 51px;
    height: 31px;
    background: #e9e9eb;
    border-radius: 16px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.iphone-checkbox::before {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.iphone-checkbox:checked {
    background: var(--accent-green);
}

.iphone-checkbox:checked::before {
    transform: translateX(20px);
}

.area-input-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.area-input-column:first-child {
    flex-shrink: 0;
    padding-top: 2px;
}

.area-input-column:nth-child(2) {
    flex: 1;
    min-width: 0;
}

.area-input-column label {
    font-size: 15px;
    color: var(--text-primary);
    cursor: pointer;
}

.area-input-column label b {
    font-weight: 500;
}

.button-anchor-container {
    position: relative;
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

.sticky-button-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    padding: var(--spacing-md) var(--spacing-lg);
    padding-bottom: calc(var(--spacing-md) + env(safe-area-inset-bottom, 0px));
    z-index: 100;
}

.sticky-button-wrapper.in-place {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    background: transparent;
    padding: 0;
}

.sticky-button-wrapper .button {
    max-width: 500px;
    margin: 0 auto;
    display: block;
}

.toast-message {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.toast-message.show {
    opacity: 1;
    visibility: visible;
}

.toast-message h2.subtitle {
    font-size: 14px;
    text-transform: none;
    letter-spacing: normal;
    margin: 0;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    background: rgba(52, 199, 89, 0.95);
    color: #fff !important;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.button {
    display: block;
    width: 100%;
    padding: var(--spacing-lg);
    background: var(--text-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 17px;
    font-weight: 600;
    font-family: var(--font-family);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-elevated);
}

.button:hover {
    background: #333333;
    transform: translateY(-1px);
}

.button:active {
    transform: scale(0.98);
}

.gray-text {
    background-color: var(--bg-primary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.green-text {
    background-color: rgba(52, 199, 89, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--accent-green);
}

.red-text {
    background-color: rgba(255, 59, 48, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--accent-red);
}

a {
    color: var(--accent-blue);
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.7;
}

@media (max-width: 525px) {
    body {
        padding: var(--spacing-md);
    }

    .container {
        padding: 0;
    }

    .small-input-field {
        width: 55px;
        font-size: 15px;
    }

    .area-input-column:nth-child(2) {
        width: calc(100% - 70px);
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #000000;
        --bg-secondary: #1c1c1e;
        --bg-card: #1c1c1e;
        --text-primary: #ffffff;
        --text-secondary: #8e8e93;
        --text-tertiary: #48484a;
        --border-color: rgba(255, 255, 255, 0.1);
        --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
        --shadow-elevated: 0 4px 16px rgba(0, 0, 0, 0.4);
    }

    .input-field,
    .input-field-2,
    .small-input-field,
    select,
    .time-input-button {
        background: #2c2c2e;
    }

    .iphone-checkbox {
        background: #39393d;
    }

    .button {
        background: #ffffff;
        color: #000000;
    }

    .button:hover {
        background: #e5e5e5;
    }
}

html {
    scroll-behavior: smooth;
}

input:focus,
select:focus,
button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

button,
.time-input-button {
    user-select: none;
    -webkit-user-select: none;
}

@keyframes checkPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.iphone-checkbox:checked {
    animation: checkPulse 0.2s ease;
}
