:root {
    --tg-bg: #ffffff;
    --tg-text: #000000;
    --tg-hint: #8e8e93;
    --tg-link: #0047ab;
    --tg-button: #31b545;
    --tg-button-text: #ffffff;
    --tg-secondary-bg: #f0f0f0;
    --tg-section-bg: #ffffff;
    --tg-border: #e9e9e9;
    --tg-danger: #ff3b30;
    --tg-warning: #ff9500;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--tg-bg);
    color: var(--tg-text);
    line-height: 1.4;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 16px;
    margin: 0 auto;
}

/* Экран приветствия */
.welcome-screen {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px 0;
}

.logo {
    text-align: center;
    margin-bottom: 20px;
}

.logo h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--tg-hint);
    font-size: 16px;
}

/* Формы */
.login-form {
    background: var(--tg-section-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.login-form h2 {
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 500;
}

.input-group {
    margin-bottom: 16px;
}

input {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--tg-border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--tg-secondary-bg);
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--tg-link);
    background: var(--tg-bg);
}

input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--tg-secondary-bg);
    color: var(--tg-text);
}

.btn-primary {
    background: var(--tg-button);
    color: var(--tg-button-text);
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 18px;
}

.btn-link {
    background: none;
    color: var(--tg-link);
    text-decoration: underline;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Карточки песен */
.songs-container {
    margin-top: 20px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--tg-secondary-bg);
    padding: 4px;
    border-radius: 12px;
}

.tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.tab.active {
    background: var(--tg-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.song-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.song-card {
    background: var(--tg-section-bg);
    border: 1px solid var(--tg-border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.song-card:hover {
    background: var(--tg-secondary-bg);
}

.song-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.song-artist {
    color: var(--tg-hint);
    font-size: 14px;
}

.song-price {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 8px;
    background: var(--tg-secondary-bg);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.price-free {
    color: var(--tg-button);
}

.price-paid {
    color: var(--tg-warning);
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
}

.page-btn {
    background: var(--tg-secondary-bg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    font-size: 14px;
    color: var(--tg-hint);
}

/* Статус стола */
.table-header {
    background: var(--tg-secondary-bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.table-badge {
    background: var(--tg-link);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.name-badge {
    background: var(--tg-button);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.debt-badge {
    background: var(--tg-danger);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.timer {
    background: var(--tg-warning);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 12px;
    background: var(--tg-bg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 90%;
    text-align: center;
}

.notification.success {
    background: var(--tg-button);
    color: white;
}

.notification.error {
    background: var(--tg-danger);
    color: white;
}

.notification.warning {
    background: var(--tg-warning);
    color: white;
}

/* Админ панель */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-title {
    font-size: 24px;
    font-weight: 500;
}

.admin-logout {
    color: var(--tg-hint);
    text-decoration: none;
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.table-card {
    background: var(--tg-section-bg);
    border: 1px solid var(--tg-border);
    border-radius: 12px;
    padding: 16px;
}

.table-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.table-card-number {
    font-size: 18px;
    font-weight: 600;
}

.table-card-debt {
    font-size: 16px;
    color: var(--tg-danger);
}

.table-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: var(--tg-secondary-bg);
    transition: all 0.2s;
}

.action-btn.pay {
    background: var(--tg-button);
    color: white;
}

.action-btn.close {
    background: var(--tg-danger);
    color: white;
}

/* Адаптивность */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .table-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .tables-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-large {
        padding: 14px;
    }
}

.hint {
    color: var(--tg-hint);
    font-size: 14px;
    text-align: center;
    margin-top: 16px;
}

.active-session {
    background: var(--tg-secondary-bg);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.session-info {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 16px 0;
}
