/* BoldVPN Portal - Clean SPA Styles */

:root {
    --bg: #0b1120;
    --panel: #0f172a;
    --muted: #94a3b8;
    --text: #e2e8f0;
    --primary: #0ea5e9;
    --primary-strong: #0284c7;
    --card: #0b1226;
    --border: #1f2a44;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html,
body {
    font-family: var(--font-family);
    background: #0f172a;
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Static Globe Background */
#static-globe-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: 
        radial-gradient(circle at 20% 30%, rgba(14, 165, 233, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(2, 132, 199, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.08) 0%, transparent 70%),
        #0b1120;
    opacity: 1;
}

body > *:not(#static-globe-background) {
    position: relative;
    z-index: 1;
}

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

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 17, 32, 0.7);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    text-decoration: none;
    color: inherit;
}

.brand .logo {
    width: 28px;
    height: 28px;
}

/* Auth Container */
#auth-container {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    max-width: 1120px;
    margin: 0 auto;
}

.auth-section {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 32px;
}

.auth-card h2 {
    font-size: 28px;
    margin: 0 0 8px;
    text-align: center;
}

.auth-subtitle {
    color: var(--muted);
    text-align: center;
    margin: 0 0 24px;
    font-size: 14px;
}

/* Forms */
.auth-form {
    display: grid;
    gap: 16px;
}

.form-group {
    display: grid;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group select {
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font-family);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
    background: rgba(15, 23, 42, 0.8);
}

.form-group input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    transition: 150ms ease;
    font-family: var(--font-family);
    background: none;
}

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

.btn-primary:hover {
    background: var(--primary-strong);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.4);
}

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

.btn-secondary:hover {
    border-color: var(--text);
    background: rgba(15, 23, 42, 0.8);
}

.btn-secondary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.3);
}

.btn-danger {
    background: var(--error-color);
    border-color: var(--error-color);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    margin-top: 15px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-info {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #7dd3fc;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

/* Portal Grid Container */
#portal-container {
    display: block;
    min-height: calc(100vh - 64px);
    background: var(--bg);
}

/* Portal Wrapper - creates floating tab effect */
.portal-wrapper {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 64px);
    gap: 0;
    width: 100%;
}

/* Sidebar */
.portal-sidebar {
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.user-info h3 {
    font-size: 1.1em;
    margin: 0 0 4px 0;
    color: var(--text);
}

.user-info p {
    font-size: 0.9em;
    color: var(--muted);
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-item {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: var(--border-radius-sm);
    margin: 2px 0;
    position: relative;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(14, 165, 233, 0.08);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
    z-index: 1;
    font-weight: 600;
}

.nav-item.active:hover {
    background: var(--primary-strong);
}

.nav-item:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--primary);
}

.nav-item span {
    font-size: 1.2em;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.sidebar-footer .btn {
    width: 100%;
}

/* Main Content - floating tab style */
.portal-content {
    background: transparent;
    overflow-y: auto;
    padding: 24px;
    min-height: calc(100vh - 64px);
}

.content-section {
    padding: 0;
    background: transparent;
    animation: fadeIn 0.3s ease;
}

/* Unified Container - floating card/tab style */
.unified-container {
    background: var(--panel);
    border-radius: var(--border-radius);
    padding: 32px;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    width: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 24px 0;
    margin: 0 0 24px 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* Search bar in section header */
.section-header input[type="search"],
.section-header input[type="text"] {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    background: var(--card);
    color: var(--text);
    font-size: 14px;
    width: 300px;
    transition: all 0.2s ease;
}

.section-header input[type="search"]:focus,
.section-header input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Form Container - constrain width for forms */
.form-container {
    max-width: 600px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 24px;
    transition: all 0.2s ease;
}

.dashboard-card:hover {
    background: rgba(15, 23, 42, 0.7);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
}

.dashboard-card h3 {
    font-size: 18px;
    margin: 0 0 16px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Usage Stats */
.usage-stats,
.speed-stats,
.devices-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.usage-label,
.speed-label {
    color: var(--muted);
    font-size: 14px;
}

.usage-value,
.speed-value {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
}

.usage-progress {
    width: 100%;
    height: 8px;
    background: var(--panel);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-strong));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.devices-count {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.devices-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.devices-label {
    color: var(--muted);
    font-size: 14px;
}

.devices-limit {
    color: var(--muted);
    font-size: 14px;
}

.subscription-info p {
    margin: 8px 0;
}

.status-active {
    color: var(--success-color);
    font-weight: 600;
}

.status-inactive {
    color: var(--error-color);
    font-weight: 600;
}

/* Devices Table - cleaner floating style */
.devices-table {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.devices-table-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 1fr 2fr;
    gap: 15px;
    padding: 16px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.85em;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.device-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 1fr 2fr;
    gap: 15px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    transition: background 0.15s ease;
    background: var(--card);
}

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

.device-row:hover {
    background: rgba(14, 165, 233, 0.08);
}


.device-row code {
    background: var(--panel);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--primary);
}

.device-row>div:last-child {
    display: flex;
    gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .portal-wrapper {
        grid-template-columns: 1fr;
    }

    .portal-sidebar {
        position: relative;
        top: 0;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: none;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 10px;
        gap: 8px;
    }

    .nav-item {
        white-space: nowrap;
        width: auto;
        border-radius: var(--border-radius-sm);
        margin-right: 0;
    }

    .nav-item.active {
        border-radius: var(--border-radius-sm);
        border: 1px solid var(--border);
    }

    .content-section {
        padding: 20px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .section-header h2 {
        font-size: 24px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .dashboard-card {
        padding: 20px;
    }

    .devices-table-header {
        display: none;
    }

    .device-row {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 15px;
    }

    .device-row>div:last-child {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--border);
    }

    .unified-container {
        padding: 20px;
    }

    .modal-content {
        padding: 24px;
        width: 95%;
        border-radius: var(--border-radius-sm);
    }

    .modal-header {
        padding-bottom: 12px;
        margin-bottom: 20px;
    }

    .modal-header h3 {
        font-size: 20px;
    }
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Modal */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(5, 8, 15, 0.85) !important;
    backdrop-filter: blur(8px);
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 10000 !important;
    animation: modalFadeIn 0.25s ease;
    visibility: visible !important;
    opacity: 1 !important;
    overflow-y: auto;
    padding: 20px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 32px;
    max-width: 600px;
    width: 100%;
    min-width: 320px;
    margin: auto;
    overflow: visible;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(148, 163, 184, 0.1);
    position: relative;
    z-index: 10001;
    box-sizing: border-box;
}

/* Allow modal content to expand naturally without scrollbar */
.modal-content form {
    overflow: visible;
}

.modal-content .form-group {
    overflow: visible;
    margin-bottom: 20px;
}

.modal-content select {
    width: 100%;
    max-width: 100%;
    padding: 12px 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    color: var(--text);
    font-size: 15px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-content select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.modal-content select option {
    background: var(--panel);
    color: var(--text);
    padding: 8px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-content select option:disabled {
    opacity: 0.5;
    font-style: italic;
    color: var(--muted);
    cursor: not-allowed;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 24px;
    margin: 0;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    font-size: 28px;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.modal-close:hover {
    color: var(--text);
    background: rgba(148, 163, 184, 0.1);
}

.modal-close:active {
    transform: scale(0.95);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    background: rgba(15, 23, 42, 0.4);
    text-align: center;
}

.footer p {
    color: var(--muted);
    font-size: 14px;
    margin: 0;
}

/* Icon Button */
.icon-button {
    background: var(--panel);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--muted);
}

.icon-button:hover {
    background: rgba(14, 165, 233, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

.icon-button svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}