/* --- Google Fonts: Inter --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    /* Telegram Dark Theme Palette (примерные значения) */
    --tg-bg-color: #181c27;
    --tg-secondary-bg-color: #232e3c;
    --tg-text-color: #ffffff;
    --tg-hint-color: #a0aec0;
    --tg-link-color: #7f00ff;
    --tg-button-color: #2f3b4a;
    --tg-button-text-color: #fff;
    --tg-header-bg-color: #232e3c; /* Фон хедера */
    --tg-border-color: #2c3142;

    --border-radius: 18px;
    --box-shadow: 0 2px 12px #0005;
    --box-shadow-light: 0 1.5px 6px #0002;
}

body, html {
    width: 100vw;
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden;
    background: var(--tg-bg-color);
    color: var(--tg-button-text-color);
    font-family: 'Inter', Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-size: 15px;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 8px;
    background: var(--tg-bg-color);
    min-height: 100vh;
    box-sizing: border-box;
    position: relative;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 480px;
    margin: 0 auto;
    background: var(--tg-secondary-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-light);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 4px 16px;
    height: 48px;
    box-sizing: border-box;
}

main {
    margin-top: 56px;
    margin-bottom: 64px;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.tab-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    max-width: 480px;
    margin: 0 auto;
    z-index: 101;
    background: rgba(24,28,39,0.98); /* или var(--tg-secondary-bg-color) */
    box-shadow: 0 -2px 12px #0002;
    border-radius: 0;
    border: none;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 54px;
    padding: 0;
    transition: background 0.18s;
}

.card, .tab-content, .profile-section {
    width: 100%;
    max-width: 100%;
    margin: 0 0 16px 0;
    box-sizing: border-box;
    background: var(--tg-secondary-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 22px 14px 16px 14px;
    border: 1px solid var(--tg-border-color);
    transition: box-shadow 0.18s, background 0.18s;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-button {
    background: none;
    border: none;
    flex: 1 1 25%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 0 2px 0;
    color: var(--tg-hint-color);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.18s;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 2px solid transparent;
    margin: 0;
}
.tab-icon {
    width: 22px;
    height: 22px;
    margin-bottom: 0;
    display: block;
}
.tab-button span {
    font-size: 10px;
    margin-top: 0;
    font-weight: 400;
    letter-spacing: 0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
}
.tab-button.active, .tab-button:focus {
    color: var(--tg-link-color);
    font-weight: 600;
    border-bottom: 2px solid var(--tg-link-color);
    background: none;
}

main h2 {
    color: var(--tg-link-color);
    margin-top: 0;
    border-bottom: 1px solid var(--tg-border-color);
    padding-bottom: 10px;
    font-size: 1.2em;
    font-weight: 700;
}

input, textarea {
    background: var(--tg-secondary-bg-color);
    color: var(--tg-button-text-color);
    border: 1px solid var(--tg-border-color);
    border-radius: 12px;
    padding: 9px 13px;
    font-size: 1em;
    margin-bottom: 10px;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--tg-link-color);
}
input::placeholder {
    color: var(--tg-hint-color);
}
button, .btn {
    background: var(--tg-button-color);
    color: var(--tg-button-text-color);
    border: none;
    border-radius: 14px;
    padding: 12px 0;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, transform 0.12s;
    box-shadow: none;
    width: 100%;
    max-width: 170px;
    margin-bottom: 6px;
}
button:hover, .btn:hover {
    background: var(--tg-link-color);
    color: #fff;
}
button:active, .btn:active {
    background: var(--tg-link-color);
    color: #fff;
    transform: scale(0.98);
}

/* Task grid fix */
.task-item .actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Убираем дубли h2/h3 */
h2, h3 {
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 18px;
    letter-spacing: 0.01em;
    font-size: 1.15em;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; background: var(--tg-bg-color); }
::-webkit-scrollbar-thumb { background: var(--tg-border-color); border-radius: 6px; }

/* SweetAlert2 override */
.swal2-popup {
    background: var(--tg-secondary-bg-color) !important;
    color: var(--tg-button-text-color) !important;
    border-radius: 18px !important;
}
.swal2-title {
    color: var(--tg-link-color) !important;
}

/* Адаптивность */
@media (max-width: 600px) {
    .app-container, main, .card, .tab-content, .profile-section {
        max-width: 100vw;
        padding-left: 4px;
        padding-right: 4px;
    }
    .tab-navigation, header {
        max-width: 100vw;
        padding-left: 4px;
        padding-right: 4px;
    }
    .tab-icon { width: 20px; height: 20px; }
    .tab-button span { font-size: 10px; }
}

/* Admin Panel Styles */
#admin-panel {
    background-color: var(--tg-secondary-bg-color);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.admin-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.admin-controls button {
    flex: 1;
    background-color: var(--tg-button-color);
}

/* User Balance Styles */
#user-balance {
    display: block;
    text-align: center;
    font-size: 1.2em;
    margin-bottom: 22px;
    background: var(--tg-secondary-bg-color);
    border-radius: 18px;
    box-shadow: var(--box-shadow);
    padding: 18px 0 10px 0;
    position: relative;
}

#user-balance h3 {
    margin-bottom: 8px;
    font-size: 1.1em;
}

#balance-amount {
    font-size: 2.3em;
    font-weight: 800;
    color: var(--tg-link-color);
    letter-spacing: 0.02em;
    vertical-align: middle;
    margin-left: 6px;
}

#user-balance:before {
    content: '💰';
    font-size: 1.7em;
    margin-right: 8px;
    vertical-align: middle;
    position: relative;
    top: 4px;
}

#withdraw-button {
    width: 100%;
    margin-top: 10px;
}

.phone-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--tg-hint-color);
}

.connect-button {
    background: var(--tg-button-color);
    color: var(--tg-button-text-color);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
}

.connect-button:hover {
    opacity: 0.9;
}

.connect-button:active {
    opacity: 0.8;
}

/* Web Login Styles */
#web-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--tg-bg-color);
    padding: 20px;
}

.web-login-content {
    background-color: var(--tg-secondary-bg-color);
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--box-shadow);
}

.web-login-content h2 {
    margin-top: 0;
    color: var(--tg-button-text-color);
    margin-bottom: 15px;
}

.web-login-content p {
    color: var(--tg-hint-color);
    margin-bottom: 20px;
}

#telegram-login-widget {
    margin: 0 auto;
}

/* Notifications */
.notifications-section ul { list-style: none; padding-left: 0; }
.notifications-section li { font-size: 14px; margin-bottom: 4px; }
.notifications-section li.reward { color: var(--tg-link-color); }
.notifications-section li.penalty { color: #e53935; }

/* --- Task subtabs (available / unavailable) --- */
.task-subtabs {
    display: flex;
    margin-bottom: 10px;
}
.task-subtab-btn {
    flex: 1 1 50%;
    background: none;
    border: none;
    padding: 8px 4px;
    color: var(--tg-hint-color);
    font-size: 0.9em;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.task-subtab-btn.active {
    color: var(--tg-link-color);
    border-bottom-color: var(--tg-link-color);
}
.tasks-subcontent {
    display: none;
}

.task-item.task-unavailable {
    opacity: 0.6;
}
.task-item.task-unavailable strong {
    color: var(--tg-hint-color);
}

/* Notification Bell */
.notif-bell {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 22px;
    cursor: pointer;
}
.notif-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: red;
    border-radius: 50%;
}

/* Timeline */
.timeline {
    position: relative;
    margin-left: 20px;
    padding-left: 10px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--tg-border-color);
}
.timeline-item {
    position: relative;
    margin-bottom: 12px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -11px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}
.timeline-item.reward { color: #4caf50; }
.timeline-item.penalty { color: #e53935; }

/* Task card */
.task-item {
    background: var(--tg-secondary-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-light);
    padding: 12px 14px;
    margin-bottom: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.task-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

/* profile cards adjustments */
#user-balance.card, #admin-panel.card, .profile-section.card {
    background: var(--tg-secondary-bg-color);
    box-shadow: var(--box-shadow);
    padding: 15px;
    border-radius: var(--border-radius);
}

button {
    transition: background-color 0.2s ease, transform 0.1s ease;
}
button:hover {
    background-color: #5aa2f6; /* lighter */
}
button:active {
    transform: scale(0.97);
}

.loading-indicator {
    background: #232837;
    color: #ffe066;
    border-radius: 14px;
    padding: 20px 28px;
    box-shadow: 0 2px 12px 0 #0006;
    text-align: center;
    margin: 40px auto;
    max-width: 340px;
}

.loading-content {
    text-align: center;
    color: var(--tg-text-color, #fff);
    padding: 20px;
    border-radius: var(--border-radius);
    background-color: var(--tg-secondary-bg-color, #1c1c1c);
    box-shadow: var(--box-shadow);
}

.loading-content p {
    margin: 0;
    font-size: 1.1em;
}

/* --- SweetAlert2 override --- */
.swal2-popup {
    background: #232837 !important;
    color: #f3f6fa !important;
    border-radius: 18px !important;
}
.swal2-title {
    color: #ffe066 !important;
}

h2, h3 {
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 18px;
    letter-spacing: 0.01em;
    font-size: 1.35em;
}

/* --- Новый современный профиль --- */
.card {
    background: #232e3c;
    border-radius: 18px;
    box-shadow: 0 2px 12px #0005;
    padding: 24px 16px 18px 16px;
    margin-bottom: 22px;
    border: 1px solid #2f3b4a;
    transition: box-shadow 0.18s, background 0.18s;
}
.card.balance-card {
    background: #26304a;
    box-shadow: 0 4px 18px #0007;
    border: 1.5px solid #2f3b4a;
    display: flex;
    flex-direction: column;
}
.balance-label {
    font-size: 1.1rem;
    color: #a0a0ff;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.balance-icon {
    font-size: 1.3em;
    margin-right: 2px;
}
.balance-amount-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}
.balance-amount {
    font-size: 2.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}
.rtm {
    font-size: 1.1rem;
    color: #00ffe7;
    font-weight: 600;
    margin-left: 4px;
}
.balance-usd {
    font-size: 1.05rem;
    color: #a0ffb0;
    font-weight: 500;
    margin-bottom: 8px;
    margin-left: 2px;
}
.history-link {
    font-size: 1rem;
    color: #7f00ff;
    text-decoration: underline;
    margin-bottom: 10px;
    margin-top: 4px;
    cursor: pointer;
    transition: color 0.2s;
}
.history-link:hover {
    color: #00ffe7;
}
.balance-actions, .ref-actions {
    display: flex;
    gap: 16px;
    margin: 18px 0 10px 0;
}
.balance-actions button, .ref-actions button, .btn {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
    font-size: 17px;
    font-weight: 700;
    padding: 13px 0;
}
.ref-label {
    font-size: 1.08rem;
    color: #b0ffe7;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ref-earned {
    font-size: 2em;
    font-weight: 800;
    margin: 10px 0 16px 0;
    text-align: left;
}
.profile-section.card {
    margin-bottom: 18px;
}
@media (max-width: 500px) {
    .card {
        padding: 10px 2px 8px 2px;
    }
    .balance-amount {
        font-size: 1.2rem;
    }
    .ref-earned {
        font-size: 1rem;
    }
    .balance-usd {
        font-size: 0.95rem;
    }
    .balance-actions, .ref-actions {
        gap: 10px;
        margin: 14px 0 8px 0;
    }
    .balance-actions button, .ref-actions button, .btn {
        font-size: 1em;
        padding: 13px 0;
        border-radius: 14px;
    }
}
/* --- Конец нового профиля --- */

.balance-actions button, .ref-actions button {
    flex: 1 1 0;
    min-width: 0;
}

#ref-card.card, .ref-card.card {
    padding: 22px 14px 18px 14px;
}

.ref-actions {
    width: 100%;
    padding: 0 2px;
    display: flex;
    gap: 16px;
    margin: 18px 0 10px 0;
}

/* --- Новый современный стиль для профиля и баланса --- */
.card.balance-card, .profile-section.card, #ref-card.card {
    background: rgba(35, 39, 47, 0.98);
    border-radius: 22px;
    box-shadow: 0 6px 32px 0 rgba(0,0,0,0.18);
    padding: 28px 18px 20px 18px;
    margin-bottom: 22px;
    border: 1.5px solid #2c3142;
    transition: box-shadow 0.18s, background 0.18s;
}

.balance-label {
    font-size: 18px;
    font-weight: 700;
    color: #b6aaff;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.balance-icon {
    font-size: 22px;
    margin-right: 4px;
}
.balance-amount-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 2px;
}
.balance-amount {
    font-size: 32px;
    font-weight: 800;
    color: #7b61ff;
    letter-spacing: 1px;
}
.rtm {
    font-size: 18px;
    color: #7b61ff;
    font-weight: 600;
}
.balance-usd {
    color: #aaa;
    font-size: 15px;
    margin-bottom: 8px;
}
.history-link {
    color: #7b61ff;
    font-size: 15px;
    text-decoration: underline;
    margin-bottom: 10px;
    display: inline-block;
}
.balance-actions {
    display: flex;
    gap: 14px;
    margin: 12px 0 10px 0;
}
.balance-actions button, .ref-actions button, .btn {
    background: linear-gradient(90deg, #7b61ff 0%, #4e8cff 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 13px 0;
    font-size: 17px;
    font-weight: 700;
    box-shadow: 0 2px 8px 0 rgba(123,97,255,0.10);
    width: 100%;
    max-width: 180px;
    margin-bottom: 0;
    transition: background 0.18s, transform 0.12s;
}
.balance-actions button:hover, .ref-actions button:hover, .btn:hover {
    background: linear-gradient(90deg, #4e8cff 0%, #7b61ff 100%);
    color: #fff;
    transform: scale(1.03);
}
.balance-actions button:active, .ref-actions button:active, .btn:active {
    background: #7b61ff;
    color: #fff;
    transform: scale(0.97);
}
.profile-info, .phone-section, .gender-section {
    margin-bottom: 10px;
}
.profile-info p, .phone-section p, .gender-section p {
    font-size: 17px;
    margin: 0 0 6px 0;
    color: #fff;
}
.profile-info strong, .phone-section strong, .gender-section strong {
    color: #7b61ff;
    font-weight: 600;
}
#gender-selection {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}
.gender-btn {
    background: #232e3c;
    color: #7b61ff;
    border: 1.5px solid #7b61ff;
    border-radius: 10px;
    padding: 8px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.gender-btn:hover, .gender-btn:active {
    background: #7b61ff;
    color: #fff;
}
#ref-card.card {
    background: rgba(35, 39, 47, 0.98);
    border-radius: 20px;
    box-shadow: 0 4px 24px 0 rgba(0,0,0,0.13);
    padding: 22px 14px 16px 14px;
    margin-bottom: 18px;
    border: 1.5px solid #2c3142;
}
.ref-label {
    font-size: 17px;
    color: #4e8cff;
    font-weight: 700;
    margin-bottom: 6px;
}
.ref-earned {
    font-size: 22px;
    color: #7b61ff;
    font-weight: 700;
    margin-bottom: 8px;
}
.ref-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}
#ref-link {
    background: #232e3c;
    color: #fff;
    border: 1px solid #7b61ff;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 14px;
    width: 100%;
    margin-top: 4px;
}

/* Улучшенная читаемость баланса и реф. награды */
.balance-amount, .ref-earned {
  color: #fff;
  text-shadow: 0 2px 8px rgba(123,97,255,0.18), 0 1px 0 #222;
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 4px;
  letter-spacing: 1.5px;
}

/* Больше воздуха вокруг баланса и реф. награды */
.balance-amount-row, .ref-earned {
  margin-bottom: 10px;
  margin-top: 6px;
}

/* Кнопки под балансом — одинаковая ширина и равные отступы */
.balance-actions {
  display: flex;
  gap: 14px;
  margin: 16px 0 10px 0;
}
.balance-actions button {
  flex-basis: 0 !important;
  flex-grow: 1 !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  box-sizing: border-box;
}

.balance-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.history-link {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 15px;
  color: #7b61ff;
  text-decoration: underline;
  margin: 0;
  z-index: 2;
}

.balance-amount-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 2px;
  position: relative;
}

.balance-usd {
  font-size: 16px;
  color: #aaa;
  margin-left: 10px;
  align-self: flex-end;
  font-weight: 500;
}

.frozen-balance-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0 0;
  font-size: 15px;
  color: #7fd6ff;
  font-weight: 500;
}
.frozen-emoji {
  font-size: 18px;
  margin-right: 2px;
}
.frozen-label {
  color: #b6eaff;
  font-size: 15px;
}
.frozen-amount {
  color: #7fd6ff;
  font-weight: 700;
  font-size: 16px;
} 