/* Qent VPN - Minimal Dark Theme */

:root {
    --bg: #1a1a1d;
    --bg-card: #232326;
    --text: #f2f2f2;
    --text-dim: #b0b0b5;
    --accent: #4CD964;
    --success: #32d74b;
    --error: #ff453a;
    --border: #3a3a3d;
    --radius: 12px;
    --space: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Make app take full viewport and restrict page scrolling; let each screen scroll individually */
html, body, #app {
    height: 100%;
    overflow: hidden;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    height: 100vh; /* ensure app doesn't exceed viewport */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.screen {
    display: none;
    padding: var(--space);
    /* reduce bottom padding to avoid extra scroll */
    padding-bottom: 24px;
    /* padding-top adjusted to avoid extra space when header is inside card */
    padding-top: var(--space);
    flex: 1;
}

.screen.active {
    display: flex;
    flex-direction: column;
    /* Use flex-start so content flows from top; prevents centering in taller screens */
    justify-content: flex-start;
    overflow: auto; /* allow screen internal scrolling */
}

/* Make inner content scrollable when needed */
.content {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.screen .header {
    /* Make header part of normal flow to allow header inside cards */
    position: static;
    padding: 0;
}

/* Header inside cards */
.card .header {
    padding: 0 0 8px 0;
    margin-bottom: 8px;
}

#loading {
    align-items: center;
    justify-content: center;
    height: 100vh;
}

#loading.active {
    display: flex;
}

.loader-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

h3 {
    font-size: 20px;
    font-weight: 500;
    margin: 0;
}

.subtitle {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 20px;
}

.card, .plan-card, .detail-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

/* Actions wrapper for buttons under cards */
.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

/* On wider screens arrange actions horizontally */
@media (min-width: 520px) {
    .actions {
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }
    .actions .btn {
        width: auto;
        min-width: 140px;
        flex: 1;
    }
}

.plan-card {
    cursor: pointer;
    border: 1px solid var(--border);
}

.plan-card.selected {
    border-color: var(--accent);
}

/* Make subscription cards look like selectable plan buttons */
#subscriptions-list .card, #subscriptions-list .plan-card {
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    box-shadow: none;
}

#subscriptions-list .card:hover, #subscriptions-list .plan-card:hover {
    /* No hover transform or shadow to keep plan cards looking like standard tariff buttons */
    transform: none;
    box-shadow: none;
    border-color: inherit; /* keep hover border unchanged; selection is handled by .selected */
}

#subscriptions-list .sub-item {
    padding: 8px 0;
}

#subscriptions-list .sub-info h3 {
    font-size: 16px;
    margin: 0 0 4px 0;
}

#subscriptions-list .status-badge {
    min-width: 76px;
    text-align: center;
}

.sub-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sub-info h3 {
    font-size: 16px;
    margin: 0 0 4px 0;
}

.sub-meta {
    font-size: 13px;
    color: var(--text-dim);
}

.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.status-active {
    color: var(--success);
    background: rgba(52, 199, 89, 0.15);
}

.status-expired {
    color: var(--error);
    background: rgba(255, 59, 48, 0.15);
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.plan-duration {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

/* Badge for special plans (e.g., year -> 'ВЫГОДНО') */
.plan-badge {
    display: inline-block;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-top: 8px;
}

.plan-price {
    font-size: 15px;
    color: var(--accent);
    font-weight: 600;
}

/* Profile selection styles removed (not used in current UI) */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    color: var(--text-dim);
    font-size: 13px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
}

.input-field:focus {
    border-color: var(--accent);
}

.input-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
}

.btn-primary {
    background: var(--accent);
    color: #000000;
    font-weight: 600;
}

.btn-primary:active {
    opacity: 0.7;
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:active {
    opacity: 0.7;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.payment-amount {
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    margin: 16px 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-dim);
    font-size: 14px;
}

.detail-row span:last-child {
    font-weight: 500;
}
