/* ==================== Base Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --gray: #64748b;
    --light: #f1f5f9;
    --white: #ffffff;
    --border: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--white);
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--dark);
}

.btn-outline:hover {
    background: var(--light);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-user {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
}

/* ==================== Navigation ==================== */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand h1 {
    font-size: 24px;
    color: var(--primary);
    font-weight: 700;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--gray);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--white);
    cursor: pointer;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.balance {
    color: var(--success);
    font-weight: 500;
}

.user-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 160px;
    display: none;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--dark);
    transition: background 0.2s;
}

.dropdown-menu a:hover {
    background: var(--light);
}

/* ==================== Pages ==================== */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ==================== Hero Section ==================== */
.hero {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    color: var(--white);
    padding: 80px 0;
    text-align: center;
}

.hero h2 {
    font-size: 36px;
    margin-bottom: 20px;
}

.hero p {
    font-size: 18px;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto 32px;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ==================== Proxy Types ==================== */
.proxy-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    padding: 60px 0;
}

.proxy-type-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    transition: box-shadow 0.3s;
}

.proxy-type-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.proxy-type-card h3 {
    font-size: 20px;
    margin-bottom: 12px;
}

.proxy-type-card .price {
    font-size: 28px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 16px;
}

/* ==================== Features ==================== */
.features {
    background: var(--light);
    padding: 60px 0;
}

.features h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 28px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.feature-item {
    background: var(--white);
    padding: 24px;
    border-radius: 8px;
}

.feature-item h4 {
    margin-bottom: 12px;
    color: var(--primary);
}

/* ==================== Coverage ==================== */
.coverage {
    padding: 60px 0;
}

.coverage h2 {
    text-align: center;
    margin-bottom: 40px;
}

.country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.country-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--light);
    border-radius: 8px;
}

.country-item .flag {
    font-size: 24px;
}

.country-item .name {
    font-weight: 500;
}

.country-item .count {
    margin-left: auto;
    color: var(--gray);
    font-size: 13px;
}

/* ==================== Buy Page - New Layout ==================== */
.buy-page-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.buy-header {
    padding: 20px 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.buy-header h2 {
    font-size: 24px;
    color: var(--dark);
}

.buy-main {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* Left Column - Selection */
.buy-selection {
    flex: 1;
    min-width: 0;
}

/* Right Column - Products & Cart */
.buy-sidebar {
    width: 380px;
    flex-shrink: 0;
}

/* Buy Step */
.buy-step {
    margin-bottom: 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.step-title {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--light);
    border-bottom: 1px solid var(--border);
    font-size: 16px;
    margin: 0;
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
}

.step-text {
    color: var(--dark);
}

/* Service List */
.service-list {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.service-item {
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.service-item:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.02);
}

.service-item.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.service-item h4 {
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--dark);
}

.service-item p {
    font-size: 13px;
    color: var(--gray);
    margin: 0;
}

/* Country List */
.country-list {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.country-item {
    padding: 10px 8px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.country-item:hover {
    border-color: var(--primary);
}

.country-item.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.country-item .flag {
    font-size: 22px;
    display: block;
    margin-bottom: 4px;
}

.country-item .name {
    font-size: 12px;
    color: var(--dark);
}

/* Operator List */
.operator-list {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.operator-item {
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 13px;
}

.operator-item:hover {
    border-color: var(--primary);
}

.operator-item.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

/* Products Panel */
.products-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.panel-title {
    padding: 14px 16px;
    background: var(--light);
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    margin: 0;
}

.products-list {
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.product-item {
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.product-item:last-child {
    margin-bottom: 0;
}

.product-item:hover {
    border-color: var(--primary);
}

.product-item.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.product-item .product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.product-item .product-name {
    font-weight: 600;
    font-size: 14px;
}

.product-item .product-period {
    font-size: 12px;
    color: var(--gray);
}

.product-item .product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-item .product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.product-item .product-unit {
    font-size: 12px;
    color: var(--gray);
}

.product-item .product-stock {
    font-size: 12px;
    color: var(--success);
}

.product-item .product-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-item .qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.product-item .qty-btn:hover {
    background: var(--light);
}

.product-item .qty-input {
    width: 50px;
    text-align: center;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* Cart Panel */
.cart-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    position: sticky;
    top: 84px;
}

.cart-items {
    padding: 16px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.cart-item .cart-label {
    color: var(--gray);
}

.cart-item .cart-value {
    color: var(--dark);
    font-weight: 500;
}

.cart-item.total {
    border-top: 2px solid var(--border);
    margin-top: 8px;
    padding-top: 12px;
}

.cart-item.total .cart-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
}

.cart-item.total .cart-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.cart-panel .btn {
    margin: 0 16px 16px;
}

/* Dynamic Packages */
.package-item {
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.package-item:last-child {
    margin-bottom: 0;
}

.package-item:hover {
    border-color: var(--primary);
}

.package-item.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.package-item .pkg-traffic {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.package-item .pkg-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.package-item .pkg-unit {
    font-size: 13px;
    color: var(--gray);
    margin-left: 4px;
}

/* Responsive */
@media (max-width: 1024px) {
    .buy-main {
        flex-direction: column;
    }
    
    .buy-sidebar {
        width: 100%;
    }
    
    .service-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .service-list {
        grid-template-columns: 1fr;
    }
    
    .country-list {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* ==================== Pricing Page ==================== */
.pricing-section {
    margin-bottom: 48px;
}

.pricing-section h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.pricing-desc {
    color: var(--gray);
    margin-bottom: 24px;
}

.pricing-table {
    overflow-x: auto;
}

.pricing-table table {
    width: 100%;
    border-collapse: collapse;
}

.pricing-table th,
.pricing-table td {
    padding: 12px 16px;
    text-align: center;
    border: 1px solid var(--border);
}

.pricing-table th {
    background: var(--light);
    font-weight: 600;
}

.pricing-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.pricing-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.pricing-card .traffic {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.pricing-card .total {
    font-size: 28px;
    color: var(--primary);
    font-weight: 700;
}

.pricing-card .unit-price {
    color: var(--gray);
    font-size: 13px;
    margin-bottom: 16px;
}

/* ==================== Dashboard ==================== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--light);
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .label {
    color: var(--gray);
    margin-top: 8px;
}

.dashboard-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.api-key-section {
    background: var(--light);
    padding: 24px;
    border-radius: 12px;
}

.api-key-section h3 {
    margin-bottom: 16px;
}

.api-key-display {
    display: flex;
    gap: 12px;
}

.api-key-display input {
    flex: 1;
}

/* ==================== Proxies List ==================== */
.filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.proxies-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.proxy-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.proxy-card .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.proxy-card .info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    font-size: 14px;
}

.proxy-card .info span {
    color: var(--gray);
}

.proxy-card .actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.proxy-format {
    background: var(--light);
    padding: 12px;
    border-radius: 6px;
    font-family: monospace;
    margin-top: 12px;
}

/* ==================== Orders List ==================== */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.order-card .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.order-card .order-no {
    font-weight: 600;
}

.order-card .status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status.expired {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* ==================== Recharge ==================== */
.recharge-form {
    max-width: 500px;
    margin: 0 auto;
    background: var(--light);
    padding: 32px;
    border-radius: 12px;
}

.quick-amounts {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.quick-amount {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 14px;
}

.quick-amount:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.quick-amount.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.payment-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-option:hover {
    border-color: var(--primary);
}

.payment-option input:checked + .payment-label {
    border-color: var(--primary);
}

.payment-option input:checked + .payment-label .payment-icon {
    color: var(--primary);
}

.payment-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.payment-label .payment-icon {
    font-size: 24px;
    font-weight: bold;
}

.payment-label small {
    color: #6b7280;
    font-size: 12px;
}

.payment-option.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

/* ==================== Help/FAQ ==================== */
.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.faq-item h4 {
    color: var(--primary);
    margin-bottom: 12px;
}

/* ==================== Modal ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.modal-footer a {
    color: var(--primary);
}

.modal-footer span {
    color: var(--gray);
    margin: 0 8px;
}

/* Login Tabs */
.login-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ==================== Forms ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--white);
}

.code-input-group {
    display: flex;
    gap: 12px;
}

.code-input-group input {
    flex: 1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* ==================== Toast ==================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: var(--white);
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.info {
    background: var(--primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==================== Footer ==================== */
.footer {
    background: var(--dark);
    color: var(--white);
    padding: 60px 0 20px;
    margin-top: 80px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    margin-bottom: 16px;
}

.footer-section p,
.footer-section a {
    display: block;
    color: rgba(255,255,255,0.7);
    margin-bottom: 8px;
}

.footer-section a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .hero h2 {
        font-size: 28px;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .payment-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== Quantity Selector ==================== */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.quantity-selector button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.quantity-selector button:hover {
    background: var(--light);
}

.quantity-selector input {
    width: 60px;
    text-align: center;
    padding: 6px;
}

/* Dynamic Packages */
.dynamic-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.package-card {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.package-card:hover {
    border-color: var(--primary);
}

.package-card.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.package-card .traffic {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.package-card .price {
    font-size: 28px;
    color: var(--primary);
    font-weight: 700;
}

.package-card .unit-price {
    color: var(--gray);
    font-size: 13px;
}
