/* ===================================================================
   PhantomStation Customer Portal — Shared Styles
   =================================================================== */

:root {
    --bg-primary:    #0a0e17;
    --bg-secondary:  #111827;
    --bg-card:       #151c2c;
    --bg-card-hover: #1a2340;
    --bg-sidebar:    #0d1220;
    --bg-input:      #0f1525;
    --border-color:  rgba(0, 229, 255, 0.12);
    --border-hover:  rgba(0, 229, 255, 0.35);
    --text-primary:  #f0f4f8;
    --text-secondary:#8b95a8;
    --text-muted:    #596478;
    --accent-cyan:   #00e5ff;
    --accent-orange: #ff6d00;
    --accent-green:  #00e676;
    --accent-red:    #ff1744;
    --accent-purple: #7c4dff;
    --gradient-main: linear-gradient(135deg, #00e5ff 0%, #7c4dff 50%, #ff6d00 100%);
    --gradient-cta:  linear-gradient(135deg, #00e5ff 0%, #00b8d4 100%);
    --shadow-md:  0 8px 30px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 40px rgba(0,229,255,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Orbitron', monospace;
    --sidebar-width: 240px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.accent { color: var(--accent-cyan); }

.gradient-text {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Auth Pages (Login / Register) ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(0,229,255,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255,109,0,0.04) 0%, transparent 50%),
        var(--bg-primary);
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-main);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 8px;
}
.auth-logo img {
    width: 36px; height: 36px;
    border-radius: 8px;
}
.auth-logo-text {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
}

.auth-title {
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 4px;
    margin-top: 20px;
}
.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
}
.form-group input::placeholder {
    color: var(--text-muted);
}
.form-group input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0,229,255,0.1);
}

.form-error {
    color: var(--accent-red);
    font-size: 0.82rem;
    margin-top: 6px;
    display: none;
}
.form-error.visible { display: block; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-family: var(--font-primary);
}
.btn-primary {
    background: var(--gradient-cta);
    color: #000;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0,229,255,0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(0,229,255,0.4);
}
.btn-sm {
    padding: 8px 20px;
    font-size: 0.85rem;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}
.btn-danger {
    background: rgba(255,23,68,0.12);
    border: 1px solid rgba(255,23,68,0.3);
    color: var(--accent-red);
}
.btn-danger:hover {
    background: rgba(255,23,68,0.2);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.plan-limit {
    margin-bottom: 24px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.plan-duration-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.plan-duration-select:focus {
    border-color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.05);
}

.plan-card .total-price-msg {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    height: 14px;
    transition: opacity 0.3s;
}

/* Custom Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: rgba(13, 22, 33, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 12px 48px rgba(0,0,0,0.5), inset 0 0 1px rgba(255,255,255,0.2);
    padding: 40px;
    border-radius: 20px;
    transform: scale(0.85);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.modal.show .modal-content {
    transform: scale(1);
    opacity: 1;
}

.auth-footer a {
    color: var(--accent-cyan);
    font-weight: 500;
}
.auth-footer a:hover { text-decoration: underline; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-glass);
}

.google-btn-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    width: 100%;
    min-height: 40px;
}

.turnstile-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    min-height: 65px;
}

/* ── Dashboard Layout ── */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-logo img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
}
.sidebar-logo span {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.sidebar-link:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}
.sidebar-link.active {
    color: var(--accent-cyan);
    background: rgba(0,229,255,0.08);
    border: 1px solid rgba(0,229,255,0.15);
}
.notification-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-red);
    border-radius: 50%;
    margin-left: auto;
    box-shadow: 0 0 10px var(--accent-red);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}
.sidebar-link .icon {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
}

.sidebar-spacer { flex: 1; }

.sidebar-user {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--gradient-cta);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #000;
    flex-shrink: 0;
}
.sidebar-user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-plan {
    font-size: 0.75rem;
    color: var(--accent-cyan);
}

.sidebar-version {
    padding: 8px 20px 16px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}
.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
}
.page-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

/* Stat Cards Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s;
}
.stat-card:hover { border-color: var(--border-hover); }
.stat-card-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.stat-card-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
}
.stat-card-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.stat-card-icon.cyan   { background: rgba(0,229,255,0.1); }
.stat-card-icon.green  { background: rgba(0,230,118,0.1); }
.stat-card-icon.orange { background: rgba(255,109,0,0.1); }
.stat-card-icon.purple { background: rgba(124,77,255,0.1); }

/* Content Cards */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
}
.content-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.content-card-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 20px 0;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}
.data-table td {
    padding: 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-secondary);
}
.data-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-active {
    background: rgba(0,230,118,0.12);
    color: var(--accent-green);
    border: 1px solid rgba(0,230,118,0.25);
}
.badge-inactive {
    background: rgba(255,23,68,0.1);
    color: var(--accent-red);
    border: 1px solid rgba(255,23,68,0.2);
}
.badge-demo {
    background: rgba(255,109,0,0.1);
    color: var(--accent-orange);
    border: 1px solid rgba(255,109,0,0.2);
}
.badge-plan {
    background: rgba(0,229,255,0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0,229,255,0.2);
}

/* License Key Box */
.license-key-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin: 16px 0;
}
.license-key-box code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 0.88rem;
    color: var(--accent-cyan);
    letter-spacing: 1px;
}
.license-key-box button {
    background: rgba(0,229,255,0.1);
    border: 1px solid rgba(0,229,255,0.2);
    color: var(--accent-cyan);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}
.license-key-box button:hover {
    background: rgba(0,229,255,0.2);
}

/* Plan Card Grid */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 24px;
}
.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px 24px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
}
.plan-card:hover { border-color: var(--border-hover); }
.plan-card.current {
    border-color: var(--accent-cyan);
    box-shadow: var(--shadow-glow);
}
.plan-card.current::after {
    content: 'Current Plan';
    position: absolute;
    top: -10px; left: 50%;
    transform: translateX(-50%);
    background: var(--gradient-cta);
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 14px;
    border-radius: 100px;
}
.plan-card h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    margin-bottom: 4px;
}
.plan-card .plan-price {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    margin: 12px 0 4px;
}
.plan-card .plan-period {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.plan-card .plan-limit {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.plan-card .btn {
    width: 100%;
}

/* Settings Form */
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px;
    margin-bottom: 24px;
}
.settings-section h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

/* Notification Toast */
.toast {
    position: fixed;
    top: 24px; right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--accent-green);
    border-radius: var(--radius-sm);
    padding: 14px 24px;
    color: var(--text-primary);
    font-size: 0.9rem;
    z-index: 9999;
    box-shadow: var(--shadow-md);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}
.toast.show { transform: translateX(0); }
.toast.error { border-color: var(--accent-red); }

/* Mobile Responsive */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
}

@media (max-width: 1024px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .plans-grid { grid-template-columns: 1fr; max-width: 380px; }
    .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .mobile-toggle { display: block; }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content {
        margin-left: 0;
        padding: 24px 16px;
        padding-top: 64px;
    }
    .stats-row { grid-template-columns: 1fr; }
    .settings-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* Loading Spinner */
.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 229, 255, 0.1);
    border-top: 3px solid var(--accent-cyan);
    border-radius: 50%;
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Ticket Chat Styles ── */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center; justify-content: center;
    z-index: 5000;
}
.modal.show { display: flex; }
.modal-content {
    background: var(--bg-card);
    width: 90%; max-width: 650px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    animation: modalSlide 0.3s ease-out;
}
@keyframes modalSlide {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    position: relative;
    z-index: 10;
}
.modal-header h2 { font-family: var(--font-display); font-size: 1.1rem; }
.close-btn { 
    background: none; border: none; color: var(--text-muted); 
    font-size: 1.8rem; cursor: pointer; 
    z-index: 20;
    line-height: 1;
}
.close-btn:hover { color: var(--accent-red); }

.modal-body { padding: 24px; }

.messages-thread {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
    line-height: 1.5;
    font-size: 0.9rem;
    word-break: break-word;
}

.chat-bubble.admin {
    align-self: flex-start;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--gradient-cta);
    color: #000;
    border-bottom-right-radius: 2px;
}

.chat-meta {
    font-size: 0.7rem;
    margin-bottom: 6px;
    opacity: 0.7;
    font-weight: 600;
}
.chat-bubble.user .chat-meta { color: rgba(0,0,0,0.6); }

.reply-section {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* ── Payment Popup Modal ── */
.payment-modal-container {
    max-width: 700px;
    width: 95%;
    overflow: hidden;
    position: relative;
}

.popup-payment-body {
    padding: 0;
    min-height: 400px;
    background: #fff; /* White background usually better for payment pages inside iframes */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.payment-loader {
    text-align: center;
    padding: 60px 40px;
    color: var(--bg-secondary);
}

.payment-loader p {
    margin-top: 16px;
    font-weight: 500;
    font-size: 0.95rem;
}

#payment-frame {
    width: 100% !important;
    height: 700px !important;
    border: none;
    background: #fff;
    position: relative;
    z-index: 1;
}

/* Language Switcher */
.language-switcher {
    padding: 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.lang-icons {
    display: flex;
    gap: 14px;
    justify-content: flex-start;
    align-items: center;
}

.lang-icon {
    width: 22px;
    height: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    background: rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    overflow: hidden;
}

.lang-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.lang-icon:hover {
    transform: translateY(-3px) scale(1.1);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 5px 15px rgba(0, 229, 255, 0.25);
}

.lang-icon.active {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
    background: rgba(0, 229, 255, 0.1);
}

.lang-icon.active img {
    transform: scale(1.2);
}

/* Auth Page Switcher (Top Right) */
.auth-lang-switcher {
    position: absolute;
    top: 24px;
    right: 32px;
    z-index: 1000;
}

