:root {
    /* Dark Theme (Default) */
    --bg-color: #121212;
    --text-color: #ffffff;
    --hint-color: #a1a1aa;
    --link-color: #3b82f6;
    --button-color: #2563eb;
    --button-text-color: #ffffff;
    --secondary-bg-color: #1e1e20;
    
    --card-bg: #1e1e20;
    --card-border: rgba(255,255,255,0.08);
    --input-bg: rgba(255,255,255,0.05);
    --danger-color: #ef4444;
    --shadow: 0 4px 12px rgba(0,0,0,0.2);
    
    --header-gradient: linear-gradient(135deg, #60a5fa, #a78bfa);
    --badge-bg: rgba(37, 99, 235, 0.15);
}

body.theme-light {
    /* Premium Light Theme */
    --bg-color: #f0f2f5;
    --text-color: #111827;
    --hint-color: #6b7280;
    --link-color: #2563eb;
    --button-color: #2563eb;
    --button-text-color: #ffffff;
    --secondary-bg-color: #e5e7eb;
    
    --card-bg: #ffffff;
    --card-border: rgba(0,0,0,0.08);
    --input-bg: #f9fafb;
    --danger-color: #ef4444;
    --shadow: 0 4px 20px rgba(0,0,0,0.06);
    
    --header-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
    --badge-bg: rgba(37, 99, 235, 0.12);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#app-container {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.app-header {
    margin-bottom: 30px;
    text-align: center;
}

.app-header h1 {
    font-size: 28px;
    font-weight: 700;
    background: var(--header-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.app-header p {
    color: var(--hint-color);
    font-size: 15px;
}

.catalog {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.service-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    transition: transform 0.2s, background 0.2s;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-card:active {
    transform: scale(0.98);
    opacity: 0.8;
}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.service-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    min-width: 0;
}

.service-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--button-color);
    background: var(--badge-bg);
    padding: 6px 12px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    max-width: 52%;
    text-align: right;
    overflow-wrap: anywhere;
}

.service-card-long-price .service-header {
    flex-direction: column;
    align-items: stretch;
}

.service-card-long-price .service-price {
    width: fit-content;
    max-width: 100%;
    align-items: flex-start;
    text-align: left;
}

.old-price {
    text-decoration: line-through;
    color: var(--hint-color);
    font-size: 12px;
    font-weight: normal;
    line-height: 1;
    margin-bottom: 2px;
}

.service-desc {
    font-size: 14px;
    color: var(--hint-color);
}

.hidden {
    display: none !important;
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--link-color);
    font-size: 16px;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin-bottom: 24px;
    padding: 0;
}

.order-form h2 {
    font-size: 22px;
    line-height: 1.18;
    margin-bottom: 8px;
}

.order-form .price {
    font-size: 18px;
    line-height: 1.25;
    color: var(--button-color);
    font-weight: 600;
    margin-bottom: 8px;
}

.selected-service-desc {
    color: var(--hint-color);
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 20px;
}

.purchase-preview {
    background: var(--badge-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 14px;
}

.purchase-preview strong {
    display: block;
    color: var(--button-color);
    font-size: 24px;
    line-height: 1.2;
    margin-top: 4px;
}

.purchase-preview.warning {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
}

.purchase-preview.warning strong {
    color: var(--danger-color);
}

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

label {
    font-size: 14px;
    color: var(--hint-color);
    font-weight: 500;
}

input {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
}

input:focus {
    border-color: var(--button-color);
}

input::placeholder {
    color: var(--hint-color);
}

.error-msg {
    color: var(--danger-color);
    font-size: 13px;
    display: none;
}

input.invalid {
    border-color: var(--danger-color);
}

input.invalid + .error-msg {
    display: block;
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--secondary-bg-color);
    border-radius: 14px;
    padding: 6px;
    margin-bottom: 24px;
    gap: 4px;
}
.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 8px;
    color: var(--hint-color);
    font-weight: 600;
    font-size: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}
.tab-btn.active {
    background: var(--button-color);
    color: var(--button-text-color);
    box-shadow: var(--shadow);
}

/* Profile */
.balance-card {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-radius: 16px;
    padding: 24px;
    color: #fff;
    margin-bottom: 24px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.balance-label {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 8px;
}
.balance-amount {
    font-size: 36px;
    font-weight: 700;
}
.credit-label {
    margin-top: 10px;
    font-size: 13px;
    background: rgba(255,255,255,0.2);
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
}
.topup-section h3 {
    margin-bottom: 16px;
    font-size: 18px;
}
.btn-primary {
    width: 100%;
    background: var(--button-color);
    color: var(--button-text-color);
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn-primary:active {
    transform: scale(0.98);
}

.btn-danger {
    width: 100%;
    background: var(--danger-color);
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn-danger:active {
    transform: scale(0.98);
}
.btn-secondary {
    width: 100%;
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--card-border);
    padding: 12px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn-secondary:active {
    background: rgba(128,128,128,0.1);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-overlay.hidden {
    display: none !important;
}
.modal-content {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 350px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
}
.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}
.modal-actions button {
    flex: 1;
}

/* Admin Table */
.admin-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
}
.user-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(128,128,128,0.1);
}
.user-row:last-child {
    border-bottom: none;
}
.user-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}
.user-info-text {
    display: flex;
    flex-direction: column;
}
.user-name {
    font-weight: 600;
    font-size: 15px;
}
.user-phone {
    font-size: 13px;
    color: var(--hint-color);
}
.user-stats {
    font-size: 13px;
    color: var(--hint-color);
    background: rgba(128,128,128,0.05);
    padding: 8px 12px;
    border-radius: 8px;
    width: 100%;
}
.user-balance-badge {
    background: var(--badge-bg);
    color: var(--link-color);
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
}
.user-actions {
    display: flex;
    gap: 8px;
    width: 100%;
}
.btn-edit {
    flex: 1;
    background: transparent;
    border: 1px solid var(--button-color);
    color: var(--button-color);
    padding: 8px 0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn-edit:active {
    background: var(--button-color);
    color: #fff;
}
