:root {
    --bg-color: #e8f5f0;
    --card-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --accent-color: #5b9a8b;
    --accent-light: #7eb8a8;
    --accent-dark: #4a8073;
    --progress-bg: #e5e7eb;
    --progress-fill: #5b9a8b;
    --border-radius: 16px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --tg-blue: #54a9eb;
    --tg-blue-hover: #4a9ad9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

.app {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--bg-color);
}

.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ===== LOADER ===== */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--progress-bg);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-dark);
}

.btn-vote {
    background: var(--accent-color);
    color: white;
    padding: 10px 20px;
    font-size: 14px;
}

.btn-vote:hover:not(:disabled) {
    background: var(--accent-dark);
}

.btn-link {
    background: none;
    color: var(--accent-color);
    padding: 8px;
    font-weight: 500;
}

.btn-stories {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    padding: 12px 24px;
    font-size: 14px;
}

/* ===== AUTH SCREEN (TELEGRAM STYLE) ===== */
.auth-screen-tg {
    background: #ffffff;
    min-height: 100vh;
}

.auth-container-tg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-step {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tg-logo {
    margin-bottom: 24px;
}

.tg-title {
    font-size: 22px;
    font-weight: 500;
    color: #000;
    margin-bottom: 8px;
    text-align: center;
}

.tg-subtitle {
    font-size: 15px;
    color: #707579;
    text-align: center;
    margin-bottom: 24px;
}

.tg-warning {
    background: transparent;
    border: 1px solid #e8a86b;
    color: #e8a86b;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    margin-bottom: 24px;
}

.tg-warning-red {
    background: transparent;
    border: 1px solid #e85555;
    color: #e85555;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    margin-bottom: 24px;
}

.tg-phone-input {
    width: 100%;
    display: flex;
    align-items: center;
    border-bottom: 2px solid #54a9eb;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.tg-phone-code {
    font-size: 17px;
    color: #000;
    padding-right: 16px;
    border-right: 1px solid #d9d9d9;
    margin-right: 16px;
}

.tg-country-select {
    font-size: 17px;
    color: #000;
    padding-right: 12px;
    border: none;
    background: transparent;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    margin-right: 12px;
}

.tg-phone-field {
    flex: 1;
    font-size: 17px;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    color: #000;
}

.tg-phone-field::placeholder {
    color: #c4c4c4;
}

.tg-code-input {
    width: 100%;
    margin-bottom: 8px;
}

.tg-code-field {
    width: 100%;
    font-size: 24px;
    text-align: center;
    letter-spacing: 12px;
    border: none;
    border-bottom: 2px solid #54a9eb;
    outline: none;
    background: transparent;
    padding: 12px;
    font-family: inherit;
    color: #000;
}

.tg-code-field::placeholder {
    color: #c4c4c4;
    letter-spacing: 8px;
}

.tg-error {
    color: #e53935;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
    margin-bottom: 16px;
}

.tg-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--tg-blue);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.tg-btn:hover {
    background: var(--tg-blue-hover);
}

.tg-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tg-link {
    background: none;
    border: none;
    color: var(--tg-blue);
    font-size: 15px;
    cursor: pointer;
    font-family: inherit;
    margin-top: 16px;
}

.tg-link:hover {
    text-decoration: underline;
}

.tg-demo-hint {
    background: #fff3cd;
    color: #856404;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    margin-bottom: 8px;
    width: 100%;
}

/* ===== 2FA STEP ===== */
.tg-lock-icon {
    display: flex;
    justify-content: center;
    align-items: center;
}

.tg-password-input {
    width: 100%;
    position: relative;
    margin-bottom: 8px;
}

.tg-password-field {
    width: 100%;
    font-size: 17px;
    border: none;
    border-bottom: 2px solid #54a9eb;
    outline: none;
    background: transparent;
    padding: 12px 40px 12px 0;
    font-family: inherit;
    color: #000;
}

.tg-password-field::placeholder {
    color: #c4c4c4;
}

.tg-toggle-password {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.tg-toggle-password:hover svg {
    stroke: #54a9eb;
}

/* ===== OLD AUTH (keep for fallback) ===== */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-step {
    width: 100%;
    max-width: 340px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
}

.phone-input-container {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.phone-code {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    border-right: 1px solid var(--progress-bg);
}

.phone-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: none;
    background: none;
    outline: none;
    font-family: inherit;
}

.code-input-container {
    margin-bottom: 16px;
}

.code-input {
    width: 100%;
    padding: 16px;
    font-size: 24px;
    text-align: center;
    letter-spacing: 8px;
    border: none;
    border-radius: 12px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    outline: none;
    font-family: inherit;
}

.error-text {
    color: #e53935;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
    margin-bottom: 8px;
}

.auth-note {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 16px;
}

.demo-hint {
    background: #fff3cd;
    color: #856404;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    margin-bottom: 16px;
}

/* ===== HERO BANNER ===== */
.hero-banner {
    position: relative;
    height: 200px;
    overflow: hidden;
    border-radius: 0 0 24px 24px;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    color: white;
}

.hero-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.hero-subtitle {
    font-size: 15px;
    opacity: 0.9;
}

/* ===== SECTION HEADER ===== */
.section-header {
    padding: 24px 16px 16px;
    text-align: center;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== CHILDREN GRID ===== */
.children-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 16px;
}

/* ===== CHILD CARD ===== */
.child-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.child-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.child-photo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.child-info {
    flex: 1;
    min-width: 0;
}

.child-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.child-city {
    font-size: 12px;
    color: var(--accent-color);
    margin-bottom: 4px;
}

.child-diagnosis {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.child-progress {
    height: 6px;
    background: var(--progress-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.child-progress-fill {
    height: 100%;
    background: var(--progress-fill);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.child-votes {
    font-size: 12px;
    color: var(--text-secondary);
}

.child-action {
    flex-shrink: 0;
}

/* ===== STORIES SECTION ===== */
.stories-section {
    position: relative;
    margin: 24px 16px;
    border-radius: var(--border-radius);
    overflow: hidden;
    height: 140px;
}

.stories-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stories-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.stories-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
}

/* ===== CHILD DETAILS SCREEN ===== */
.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--accent-color);
    cursor: pointer;
    font-family: inherit;
}

.child-details {
    padding: 0 16px 24px;
}

.child-details-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 16px;
    display: block;
    box-shadow: var(--shadow);
}

.child-details-name {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.child-details-city {
    text-align: center;
    font-size: 14px;
    color: var(--accent-color);
    margin-bottom: 4px;
}

.child-details-diagnosis {
    text-align: center;
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.child-details-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.child-details-card h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.child-details-card p {
    font-size: 15px;
    line-height: 1.6;
}

.child-details-progress {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.progress-label {
    font-size: 14px;
    font-weight: 600;
}

.progress-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.progress-bar {
    height: 12px;
    background: var(--progress-bg);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-light));
    border-radius: 6px;
    transition: width 0.5s ease;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 32px;
    text-align: center;
    max-width: 320px;
    width: 100%;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.modal-content h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.modal-content p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 500px) {
    .children-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .child-card {
        flex-direction: column;
        text-align: center;
    }
    
    .child-info {
        width: 100%;
    }
    
    .child-action {
        width: 100%;
    }
    
    .btn-vote {
        width: 100%;
    }
}
