/* CSS Variables for theming */
:root {
    /* Dark theme (default) */
    --bg-primary: #070a0b;
    --bg-secondary: #0f151b;
    --bg-tertiary: #090E12;
    --bg-quaternary: #151a21;
    --bg-header: rgba(13, 19, 26, 0.8);
    --bg-input: #090E12;
    
    --text-primary: #e2e8f0;
    --text-secondary: #f7fafc;
    --text-tertiary: #cbd5e0;
    --text-muted: #a0aec0;
    --text-white: white;
    
    --border-primary: rgba(255, 255, 255, 0.1);
    --border-secondary: #2d3748;
    --border-input: #4a5568;
    
    --shadow-primary: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-button: 0 0 0 3px rgba(102, 126, 234, 0.2);
    
    --accent-primary: #448cf1;
    --accent-hover: #407bce;
    --success: #9ade1d;
    --danger: #f56565;
    --green: #9ADE1D;
    --color-block-bg: #0D131A;
    
    --btn-light-bg: #ffffff;
    --btn-light-text: #333333;
    --btn-dark-bg: #151a21;
    --btn-dark-text: #ffffff;
    
    /* Button colors */
    --button-first-bg: #ffffff;
    --button-second-bg: #151a21;
    --button-red-bg: #f60b47;
    --button-green-bg: #9ADE1D;
    --btn-text-white: #ffffff;
    --btn-text-black: #000000;
    
    --pulse-color: #00000070;
    
    --backdrop: blur(10px);

    --opacity-pay: 0.4;

    --active-gradient: linear-gradient(to top left, #1EDE1D33, #0d181a);
    --frozen-gradient: linear-gradient(to top left, #00CCFF33, #0d191a);
    --inactive-gradient: linear-gradient(to top left, #F60B4733, #1a0d17);
    --bottom-wrapper-bg: rgba(255, 255, 255, 0.03);
}

/* Light theme (switched) */
[data-theme="light"] {
    /* --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    --bg-primary: #ececec;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f7fafc;
    --bg-quaternary: #edf2f7;
    --bg-header: rgba(255, 255, 255, 0.1);
    --bg-input: #f7fafc;
    
    --text-primary: #333;
    --text-secondary: #2d3748;
    --text-tertiary: #4a5568;
    --text-muted: #5f6f86;
    --text-white: white;
    
    --border-primary: rgba(255, 255, 255, 0.2);
    --border-secondary: #e2e8f0;
    --border-input: #e2e8f0;
    
    --shadow-primary: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-button: 0 0 0 3px rgba(102, 126, 234, 0.1);
    
    --accent-primary: #667eea;
    --accent-hover: #5a67d8;
    --success: #9ade1d;
    --danger: #f56565;
    
    --btn-light-bg: #151a21;
    --btn-light-text: #ffffff;
    --btn-dark-bg: #ffffff;
    --btn-dark-text: #333333;
    
    /* Button colors */
    --button-first-bg: #ffffff;
    --button-second-bg: #151a21;
    --button-red-bg: #f60b47;
    --button-green-bg: #9ADE1D;
    --btn-text-white: #ffffff;
    --btn-text-black: #000000;
    
    --pulse-color: #ffffff70;
    
    --backdrop: blur(10px);

    --opacity-pay: 0.6;

    --active-gradient: linear-gradient(to top left, #45aa45e6, #98b79e);
    --frozen-gradient: linear-gradient(to top left, #00ccff4f, #d1e8ea);
    --inactive-gradient: linear-gradient(to top left, #f60b4769, #e1ccdc);
    --bottom-wrapper-bg: rgba(255, 255, 255, 0.1);
}

/* Light theme header buttons adjustments when menu open */
[data-theme="light"] .header-container.menu-open .burger-btn {
    background: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .header-container.menu-open .burger-btn span {
    background: #2d3748 !important;
}

[data-theme="light"] .header-container.menu-open .theme-toggle-header {
    background: rgba(0, 0, 0, 0.1) !important;
    color: #2d3748 !important;
}

[data-theme="light"] .logo-text {
    color: #2d3748 !important;
}

[data-theme="light"] .header-container.menu-open .logo-text {
    color: #2d3748 !important;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    overflow-x: hidden;
}

body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    transition: none;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    overflow-x: hidden;
    font-display: swap;
}

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

.main-container {
    background: var(--bg-tertiary)!important;
    border-radius: 20pt;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media screen and (min-width: 600px) {
    .top-container {
            padding: 20px 0px !important;
        }
}

/* Burger button */
.burger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--button-second-bg);
    border: 0px solid var(--btn-text-white) !important;
    border-radius: 50% !important;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.burger-btn span {
    position: absolute;
    left: 9px;
    right: 9px;
    height: 2px;
    background: var(--btn-text-white) !important;
    border-radius: 2px;
    transform-origin: center;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

/* Two-line layout: hide middle line, position top/bottom */
.burger-btn span:nth-child(1) { transform: translateY(-5px); }
.burger-btn span:nth-child(2) { display: none; }
.burger-btn span:nth-child(3) { transform: translateY(5px); }

/* Active state → cross */
.burger-btn.active span:nth-child(1) { transform: rotate(45deg); }
.burger-btn.active span:nth-child(3) { transform: rotate(-45deg); }

/* Mobile menu */
.mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-radius: 0 0 30px 30px;
    max-width: 600px;
    margin: 0 10px;
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, background 0.3s ease, border-radius 0.3s ease;
}

.mobile-menu.active {
    max-height: 500px;
    opacity: 1;
    padding: 20px;
}

.header-container.menu-open {
    background: var(--bg-secondary);
}

/* Menu overlay backdrop */
.menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
}

.mobile-menu-content {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.mobile-menu-header {
    display: none;
}

.mobile-menu-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu-items .btn {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    position: relative;
    padding-left: 50px !important;
    text-align: left !important;
}

.mobile-menu-items .btn span:first-child {
    position: absolute;
    left: 20px;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.mobile-menu-items .btn span:last-child {
    text-align: left !important;
    width: 100%;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: none;
    text-align: left;
    width: 100%;
}

.mobile-menu-item:hover {
    background: var(--bg-quaternary);
    transform: translateX(5px);
}

.mobile-menu-item.cache-item {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
    color: var(--accent-primary);
}

.mobile-menu-item.cache-item:hover {
    background: rgba(102, 126, 234, 0.2);
}

.mobile-menu-item.logout-item {
    background: rgba(245, 101, 101, 0.1);
    border-color: rgba(245, 101, 101, 0.3);
    color: var(--danger);
}

.mobile-menu-item.logout-item:hover {
    background: rgba(245, 101, 101, 0.2);
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
}

/* Loading screen */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: var(--text-white);
    text-align: center;
    background: var(--bg-primary) !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

.preloader {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
}

.preloader-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: #48bb78 !important;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: preloader-pulse 1.2s ease-in-out infinite;
    z-index: 1000;
}

.preloader-circle:nth-child(1) {
    animation-delay: 0s;
}

.preloader-circle:nth-child(2) {
    animation-delay: 0.6s;
}

@keyframes preloader-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Error screen */
.error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.error-card {
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 48px 32px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 24px;
}

.error-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.error-card p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.5;
}

.error-card .btn {
    width: 100%;
    max-width: 280px;
}

/* Header */
.header {
    transition: none;
    width: 100%;
    position: relative;
    z-index: 100;
    max-width: 600px;
    margin: 0 auto;
    margin-top: 10px;
}

.header-container {
    margin: 0 10px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 30px 30px 0 0;
    
    transition: background 0.3s ease, border-radius 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    height: 40px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    border-radius: 50%;
}

.logo-text {
    font-weight: 700;
    color: var(--text-white);
    font-size: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-white);
    font-weight: 600;
    position: relative;
}

.theme-toggle-header {
    background: var(--button-second-bg) !important;
    border: 0px solid var(--btn-text-white) !important;
    border-radius: 50% !important;
    color: var(--btn-text-white) !important;
    padding: 0.5rem !important;
    width: 2.5rem !important;
    height: 2.5rem !important;
    min-width: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-size: 1rem !important;
}

.theme-toggle-header:active {
    transform: translateY(0) !important;
}

.theme-toggle-header span {
    font-size: 1rem !important;
}

/* Cards */
.card {
    background: var(--bg-secondary) !important;
    box-shadow: 0 0 15px 3px #0000000d;
    border-radius: 17pt;
    padding: 2rem;
    backdrop-filter: var(--backdrop);
    transition: none;
}

.card h2 {
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0;
    color: var(--text-secondary);
}

/* Balance Card - New Design */
.balance-wrapper {
    padding: 18px;
}

.balance-card-info {
    background: var(--color-block-bg);
    border-radius: 13pt;
    color: var(--text-primary);
    width: 100%;
    box-sizing: border-box;
}

/* Состояния карточки */
.balance-card-info.active {
    background: var(--active-gradient);
}

.balance-card-info.frozen {
    background: var(--frozen-gradient);
}

.balance-card-info.inactive {
    background: var(--inactive-gradient);
}

/* Верхняя часть */
.balance-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.balance-card-title {
    color: var(--text-muted);
    font-size: 14px;
}

.balance-status {
    color: var(--green);
    background-color: #1a1f1a;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
}

.balance-status.warning {
    color: #00CCFF;
    background-color: #1f1f1a;
}

.balance-status.inactive {
    color: #f56565;
    background-color: #1f1a1a;
}


/* Основная часть с балансом */
.balance-card-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.balance-card-main .icon-size {
    margin-right: 5px;
    margin-left: 5px;
    font-size: 20px;
}

.account-balance-num {
    font-size: 25pt;
    font-weight: 600;
    color: var(--text-primary);
}

.account-balance-num b {
    color: var(--text-muted);
    font-weight: 500;
}

/* Нижняя часть с информацией */
.balance-card-bottom-wrapper {
    background-color: var(--bottom-wrapper-bg);
    padding: 15px 20px;
    border-radius: 0 0 15px 15px;
}

.balance-card-bottom {
    display: flex;
    justify-content: space-between;
}

.balance-expense-box {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.balance-expense-title {
    font-size: 14px;
    color: var(--text-muted);
}

.balance-expense-amount {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.balance-expense-green {
    color: var(--green);
    font-size: 13px;
}

/* Subscription card - Clean Design */
.subscription-card {
    background: var(--bg-secondary) !important;
    position: relative;
}

.subscription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.subscription-footer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
    gap: 7px;
}

.config-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.config-actions .btn {
    width: 100%;
}

.status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-quaternary)!important;
    border-radius: 30px;
    padding: 0 8px;
}

.status-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-indicator.active {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(154, 222, 29, 0.3);
}

.status-indicator.warning {
    background: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3);
}

.status-indicator.inactive {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.3);
}


.days-left {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.end-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Configs card */
.configs-list {
    display: grid;
    gap: 0.5rem;
    margin-top: 15px;
}

.config-item {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

/* Новый стиль для конфигов */
.config-item-new {
    background: var(--bg-quaternary) !important;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.config-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
    color: var(--text-secondary);
}

.device-icon i {
    display: block;
}

.device-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f56565; /* По умолчанию красный (неактивен) */
    flex-shrink: 0;
}

.status-circle.active {
    background: #9ade1d!important;
}

.status-circle.inactive {
    background: #f56565!important;
}

.config-arrow {
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-secondary)!important;
    border-radius: 50%;
    flex-shrink: 0;
}

.config-arrow i {
    display: block;
}

.config-item-new:hover .config-arrow {
    color: var(--success);
    transform: translateX(3px);
}

.config-info h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.config-info p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.config-actions {
    display: flex;
    gap: 0.5rem;
}

.config-url {
    margin-top: 0.75rem;
}

.config-url label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.config-url-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-input);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: monospace;
}

.config-url-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
}

/* Config status badges */
.config-status {
    margin-top: 0.5rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.active {
    background: rgba(154, 222, 29, 0.2);
    color: #9ade1d;
    border: 1px solid rgba(154, 222, 29, 0.3);
}

.status-badge.inactive {
    background: rgba(245, 101, 101, 0.2);
    color: #f56565;
    border: 1px solid rgba(245, 101, 101, 0.3);
}

/* Config details page */
.config-details-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 1000;
    overflow-y: auto;
}

.config-details-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.config-details-header {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.config-details-header h2 {
    color: var(--text-white);
    margin: 0;
}

.config-details-content {
    display: grid;
    gap: 1.5rem;
}

.config-info-card,
.config-url-card,
.config-error-card,
.config-actions-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-secondary);
}

.config-info-card h3,
.config-url-card h3,
.config-error-card h3,
.config-actions-card h3 {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-secondary);
}

.info-item:last-child {
    border-bottom: none;
}

.info-item label {
    font-weight: 500;
    color: var(--text-tertiary);
}

.info-item span {
    color: var(--text-secondary);
}

.uuid-text {
    font-family: monospace;
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.help-text {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.config-error-card {
    border-left: 4px solid var(--danger);
}

.config-error-card h3 {
    color: var(--danger);
}

.no-configs {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.no-keys-message {
    background: var(--bg-quaternary);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    margin-top: 15px;
}

.no-keys-message p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Referral card */
.referral-card {
    background: var(--bg-secondary) !important;
}

.referral-wrapper {
    display: grid;
    gap: 1.5rem;
}

/* Referral Header */
.referral-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.referral-icon {
    width: 60px;
    height: 60px;
    background: var(--accent-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #ffffff;
    flex-shrink: 0;
}

.referral-title {
    flex: 1;
}

.referral-title h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.referral-title p {
    margin: 0.25rem 0 0 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Referral Stats */
.referral-stats {
    background: var(--bg-quaternary) !important;
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.referral-stats-icon {
    width: 50px;
    height: 50px;
    background: var(--bg-quaternary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.referral-stats-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.referral-stats-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.referral-stats-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1;
}

/* Referral Code */
.referral-code {
    display: grid;
    gap: 0.75rem;
}

.referral-code label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.referral-code label i {
    color: var(--green);
    font-size: 1rem;
}

.referral-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.referral-input-wrapper input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    background: var(--bg-input) !important;
    color: var(--text-primary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.referral-input-wrapper input:focus {
    outline: none;
}

.referral-input-wrapper .btn {
    width: 100%;
    height: 50px;
    font-weight: 600;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-input) !important;
    color: var(--text-primary);
    transition: none;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-button);
}

/* Buttons - Base styles */
button, .btn {
    font-family: 'TT Firs Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 30px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 15px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    background: transparent;
    flex-shrink: 0;
    width: auto;
    height: 50px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transform: scale(1);
    transition: transform 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    text-decoration: none;
}

/* Эффект при нажатии - кнопка уменьшается */
button:active, .btn:active {
    transform: scale(0.90);
}

button.touch-active, .btn.touch-active {
    transform: scale(0.90);
}

/* Типы кнопок */
.white-btn, .btn-primary {
    background: var(--accent-primary) !important;
    color: var(--text-white) !important;
}

.dark-btn, .btn-light {
    background: var(--btn-light-bg) !important;
    color: var(--btn-light-text) !important;
}

.green-btn {
    background-color: var(--green);
    color: var(--btn-text-black);
}

.red-btn, .btn-red {
    background: #DA364820 !important;
    color: #D44352 !important;
    border: 1px solid #DA364810;
}

.pay-btn {
    background: linear-gradient(270deg, #9ADE1D, #79e741);
    background-size: 300% 300%;
    animation: gradientShift 4s ease infinite;
    color: var(--btn-text-black);
    width: 100%;
    height: 50px;
    font-size: 16px;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Legacy button classes for compatibility */
.btn-dark {
    background: var(--btn-dark-bg) !important;
    color: var(--btn-dark-text) !important;
}

.btn-purple {
    background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
    color: var(--text-white) !important;
}

.btn-outline {
    background: transparent !important;
    color: var(--text-white) !important;
}

.btn-secondary {
    background: var(--bg-tertiary) !important;
    color: var(--text-tertiary) !important;
}

.btn-sm {
    padding: 8px 20px;
    font-size: 14px;
    height: 40px;
}

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

.pulse-btn {
    position: relative;
}

.pulse-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
    animation: halo-dark 1.4s ease-out infinite;
}

[data-theme="light"] .pulse-btn::after {
    animation: halo-light 1.4s ease-out infinite;
}

@keyframes halo-light {
    0% {
        opacity: 0;
        box-shadow: 0 0 0 0 #00000070;
    }
    20% {
        opacity: 1;
    }
    90% {
        opacity: 0;
        box-shadow: 0 0 0 15px transparent;
    }
    100% {
        opacity: 0;
    }
}

@keyframes halo-dark {
    0% {
        opacity: 0;
        box-shadow: 0 0 0 0 #ffffff70;
    }
    20% {
        opacity: 1;
    }
    90% {
        opacity: 0;
        box-shadow: 0 0 0 15px transparent;
    }
    100% {
        opacity: 0;
    }
}

#create-config-btn {
    margin-bottom: 10px;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: #fbbf24;
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--text-muted);
}

/* Responsive design */
@media (max-width: 768px) {
    .card {
        padding: 1.5rem;
    }
    
    .header-container {
        justify-content: space-between;
        align-items: center;
    }
    
    .logo-img {
        height: 35px;
        max-width: 150px;
    }
    
    .user-info {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .user-info span {
        font-size: 14px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .config-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .config-actions {
        justify-content: center;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    
    /* Force dark background on mobile */
    html, body, #app {
        background: var(--bg-primary);
        background-attachment: fixed;
        background-repeat: no-repeat;
        background-size: cover;
        min-height: 100vh;
    }
}

/* Mobile menu works on all devices */

/* Animation for smooth transitions */
.card {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Copy button animation */
.btn.copied {
    background: var(--success);
    animation: pulse 0.3s ease-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* App container */
#app {
    min-height: 100vh;
    background: var(--bg-primary);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Ensure no white background on basic elements */
html, body, #app {
    background-color: transparent;
}

body, html, #app {
    background: var(--bg-primary);
    background-attachment: fixed;
}

/* Force dark background on all elements */
*::before,
*::after {
    background-color: transparent;
}

/* Prevent white background on scroll */
html, body, #app, .main, .container {
    background: var(--bg-primary);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Override any potential white backgrounds */
div, section, article, main, header, footer {
    background-color: transparent;
}

/* Ensure mobile menu doesn't show white background */
.mobile-menu {
    background: var(--bg-secondary) !important;
}

/* Force dark theme on all pseudo-elements */
html::before,
html::after,
body::before,
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary) !important;
    z-index: -9999;
    pointer-events: none;
}

/* Additional dark background fixes */
html, body {
    background-color: var(--bg-primary);
    background-image: var(--bg-primary);
}



/* Hide scrollbar but keep scroll functionality */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: transparent;
}

/* For Firefox */
html {
    scrollbar-width: none;
}

/* For IE and Edge */
body {
    -ms-overflow-style: none;
}

/* Config Details Page Styles */
.config-details-page {
    min-height: 100vh;
    background: var(--bg-primary);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
}

.config-url-section {
    padding: 1rem 0;
}

.config-url-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.875rem;
    word-break: break-all;
}

/* TV Code Section */
.tv-code-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-secondary);
}

.tv-code-header {
    margin-bottom: 1rem;
}

.tv-code-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tv-code-header h3 i {
    color: var(--accent-primary);
}

.tv-code-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tv-code-instruction {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.tv-code-instruction code {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.tv-code-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.tv-code-value {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-code-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: 0.1em;
    font-family: 'Courier New', monospace;
    text-align: center;
    padding: 1rem 2rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 2px solid var(--success);
    box-shadow: 0 0 20px rgba(154, 222, 29, 0.2);
}

.loading-spinner {
    color: var(--text-muted);
    font-size: 1.5rem;
}

.error-text {
    color: var(--danger);
    font-size: 0.9rem;
}

.tv-code-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-style: italic;
}

.tv-code-note i {
    color: var(--accent-primary);
}

/* TV Installation Steps */
.tv-instruction-steps {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tv-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.tv-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.tv-step-content {
    flex: 1;
    padding-top: 4px;
}

.tv-step-content strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.tv-step-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.tv-step-content code {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.tv-code-hint {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 3px solid var(--success);
}

.tv-code-hint strong {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.tv-code-display-hint {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: 0.1em;
    font-family: 'Courier New', monospace;
    margin-left: 0.5rem;
}

/* TV Code Step Section (на шаге 3) */
.tv-code-step-section {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tv-code-display-box {
    background: var(--bg-quaternary);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.tv-code-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 500;
}

.tv-code-value-box {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-code-number-step {
    font-size: 2rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: 0.1em;
    font-family: 'Courier New', monospace;
    text-align: center;
}

.tv-site-hint {
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 0.75rem;
    border-left: 3px solid var(--accent-primary);
}

.tv-site-hint p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: center;
}

.tv-site-hint code {
    background: var(--bg-quaternary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

/* PC Installation Styles */
.pc-key-section {
    margin: 1.5rem 0;
}

.pc-instruction-text {
    margin: 1rem 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pc-subscription-url-box {
    background: var(--bg-quaternary);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    word-break: break-all;
    overflow-wrap: break-word;
}

.pc-subscription-url {
    color: var(--success);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    display: block;
}

.pc-tip-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-quaternary);
    border-radius: 12px;
    border-left: 3px solid var(--primary);
}

.pc-tip-text {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.9rem;
}

.pc-tip-text i {
    color: var(--primary);
    margin-right: 0.5rem;
}

.config-error-section {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.config-error-section p:first-child {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.action-buttons {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Config actions buttons */
.config-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Installation Steps Styles */
.installation-card {
    background: var(--bg-secondary) !important;
    position: relative;
}

.installation-card h2.back-button {
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.installation-card h2.back-button:hover {
    transform: translateX(-3px);
}

.installation-card h2.back-button::before {
    content: '\f053';
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-quaternary)!important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 14px;
    color: var(--text-muted);
}

.installation-steps {
    padding: 2rem 0;
}

.installation-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-secondary);
}

.installation-footer .btn {
    width: 100%;
    height: 50px;
    font-size: 14px;
}

.installation-step {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.installation-step.active {
    opacity: 1;
    transform: translateY(0);
}

.step-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    position: relative;
}

.step-icon i {
    font-size: 2rem;
}

.step-icon::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    opacity: 0.2;
    z-index: -1;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.2;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.installation-step h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.installation-step p {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.5;
    margin-left: auto;
    margin-right: auto;
}

.installation-step p code {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.step-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0 auto;
}

.step-buttons .btn {
    width: 100%;
    height: 50px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.step-buttons .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.step-buttons .btn:hover::before {
    left: 100%;
}

.step-buttons .btn:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Анимация появления шагов */
.installation-step.active .step-icon {
    animation: step-icon-appear 0.6s ease-out;
}

@keyframes step-icon-appear {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.installation-step.active h3 {
    animation: step-title-appear 0.6s ease-out 0.2s both;
}

.installation-step.active p {
    animation: step-subtitle-appear 0.6s ease-out 0.4s both;
}

.installation-step.active .step-buttons {
    animation: step-buttons-appear 0.6s ease-out 0.6s both;
}

@keyframes step-title-appear {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes step-subtitle-appear {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes step-buttons-appear {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для финального шага (шаг 4) */
.installation-step.final-step .step-icon {
    background: linear-gradient(135deg, #10CC42, #0BA83A) !important;
    box-shadow: 0 8px 25px rgba(16, 204, 66, 0.3) !important;
}

.installation-step.final-step .step-icon::before {
    background: linear-gradient(135deg, #10CC42, #0BA83A) !important;
}

.installation-step.final-step .step-buttons .btn-primary {
    background: #10CC42 !important;
    color: white !important;
}

.installation-step.final-step .step-buttons .btn-primary:hover {
    background: #0BA83A !important;
    box-shadow: 0 8px 25px rgba(16, 204, 66, 0.3);
}

/* Payment Modal Styles */
.payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.payment-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #090e12ba !important;
    backdrop-filter: blur(8px);
}

.payment-container {
    position: relative;
    background: var(--bg-secondary)!important;
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
}

.payment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 28px 24px;
}

.payment-header h2 {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1.4rem;
    font-weight: 700;
}

.close-payment {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 12px;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-payment:hover {
    background: var(--bg-quaternary);
    color: var(--text-primary);
}

.payment-content {
    padding: 0 28px 50px;
    max-height: 60vh;
    overflow-y: auto;
}

.payment-step {
    display: none;
}

.payment-step.active {
    display: block;
}

.payment-step h3 {
    margin: 0 0 20px 0;
    color: var(--text-tertiary);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Payment Methods - Grid Style */
.payment-methods {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.payment-method-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    min-height: 100px;
    overflow: hidden;
}

.payment-method-btn.selected {
    background: #448cf140;
}

.payment-method-btn.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    z-index: 2;
}

.payment-method-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.payment-method-btn span {
    position: relative;
    z-index: 1;
    line-height: 1.3;
    max-width: 60%;
}

.payment-method-btn small {
    position: absolute;
    bottom: 12px;
    left: 12px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: 8px;
    z-index: 2;
}

.payment-method-btn::before {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 100px;
    height: 100%;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    opacity: var(--opacity-pay);
    transition: all 0.2s ease;
}

.payment-method-btn[data-method="sbp"]::before {
    background-image: url('/static/sbp.png');
}

.payment-method-btn[data-method="card"]::before {
    background-image: url('/static/master-visa-mir.png');
}

.payment-method-btn[data-method="crypto"]::before {
    background-image: url('/static/btc.png');
}

/* Subscription Plans */
.subscription-plans {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Адаптивная сетка: 3 колонки на больших экранах, 2 на средних, 1 на маленьких */
@media (max-width: 480px) {
    .subscription-plans {
        grid-template-columns: repeat(3, 1fr);
    }
}

.plan-btn {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.plan-btn:hover {
    background: var(--bg-quaternary);
}

.plan-btn.selected {
    background: #448cf140;
}

.plan-btn.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
}

.plan-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.plan-period {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.plan-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Payment Summary */
.payment-summary {
    background: var(--bg-tertiary)!important;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    color: var(--text-tertiary);
}

.summary-item:not(:last-child) {
    opacity: 0.8;
}

.summary-item.total {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-top: 12px;
    padding-top: 20px;
    position: relative;
    opacity: 1;
}

.summary-item.total::before {
    content: '';
    position: absolute;
    top: 0;
    left: -24px;
    right: -24px;
    height: 2px;
    background: var(--bg-quaternary);
}

.payment-error {
    text-align: center;
    padding: 20px;
}

.payment-error h4 {
    margin-bottom: 15px;
}

.payment-error .payment-actions {
    margin-top: 20px;
}

/* Payment Footer */
.payment-footer {
    display: flex;
    gap: 12px;
    padding: 0 28px 28px;
}

.payment-footer .btn {
    flex: 1;
    height: 52px;
    font-size: 1rem;
    font-weight: 600;
}

/* Device Types Grid */
.device-types {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.device-type-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    min-height: 100px;
    overflow: hidden;
}

.device-type-btn:hover {
    background: var(--bg-quaternary);
}

.device-type-btn.selected {
    background: #448cf140;
}

.device-type-btn.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    z-index: 2;
}

.device-type-btn span {
    position: relative;
    z-index: 1;
    line-height: 1.3;
    max-width: 60%;
}

.device-type-btn small {
    position: absolute;
    bottom: 12px;
    left: 12px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: 8px;
    z-index: 2;
}

.device-type-btn::before {
    content: '';
    position: absolute;
    right: -30px;
    bottom: -20px;
    width: 150px;
    height: 130px;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: top;
    opacity: var(--opacity-pay);
    transition: all 0.2s ease;
}

.device-type-btn[data-device="iphone"]::before {
    background-image: url('/static/iphone.webp');
}

.device-type-btn[data-device="android"]::before {
    background-image: url('/static/android.webp');
}

.device-type-btn[data-device="pc"]::before {
    background-image: url('/static/pc.webp');
}

.device-type-btn[data-device="tv"]::before {
    background-image: url('/static/tv.webp');
}

/* Android Installation Styles */
.android-app-selection {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.android-app-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    height: 80px;
}

.android-app-btn:hover {
    background: var(--bg-quaternary);
}

.app-icon {
    width: 50px;
    height: 50px;
    border-radius: 20px;
    overflow: hidden;
    flex-shrink: 0;
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-info {
    flex: 1;
}

.app-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--text-primary);
}

.app-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.app-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-quaternary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.app-arrow i {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.android-app-btn:hover .app-arrow {
    background: var(--accent-primary);
}

.android-app-btn:hover .app-arrow i {
    color: white;
}

/* Key Copy Section */
.key-copy-section {
    margin: 20px 0;
}

.instruction-image {
    margin-bottom: 20px;
}

.image-placeholder {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.image-placeholder i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.image-placeholder p {
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 480px) {
    .payment-container {
        max-height: 95vh;
        border-radius: 20px;
    }
    
    .payment-header {
        padding: 24px 20px 20px;
    }
    
    .payment-content {
        padding: 0 20px 50px;
    }
    
    .payment-footer {
        padding: 0 20px 24px;
    }
}

/* Стили для кнопки "Ручная установка" только в первом шаге */
.installation-step .step-buttons .btn-light[data-action="otherDevice"] {
    background: var(--bg-quaternary) !important;
    color: var(--text-muted) !important;
    font-weight: 500;
    border: 1px solid #a0aec010;
}