/* ============================================================
   ARXD Hosting — Client Portal Stylesheet
   ============================================================ */

/* ----- Variables (matches main site theme) ---------------- */
:root {
    --primary:    #00ffcc;
    --secondary:  #ff00ff;
    --accent:     #00d4ff;
    --dark:       #0a0a0f;
    --dark-light: #1a1a2e;
    --dark-mid:   #0d0d18;
    --text:       #e0e0e0;
    --text-muted: #888;
    --border:     rgba(0, 255, 204, 0.15);
    --sidebar-w:  230px;

    /* Status colours */
    --status-active:    #00ffcc;
    --status-pending:   #f0a500;
    --status-suspended: #ff4444;
    --status-cancelled: #888;
    --status-paid:      #00ffcc;
    --status-unpaid:    #f0a500;
    --status-open:      #00d4ff;
    --status-closed:    #888;
    --status-answered:  #00ffcc;
}

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

/* ----- Shared background elements ------------------------- */
body.portal-body,
body.auth-body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--dark);
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Reuse bg-grid and orbs from main site */
.bg-grid {
    position: fixed;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(0, 255, 204, 0.03) 1px, transparent 1px),
        linear-gradient(rgba(0, 255, 204, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridScroll 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gridScroll {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    pointer-events: none;
    animation: orbFloat 20s infinite ease-in-out;
    z-index: 0;
}
.orb1 { width: 400px; height: 400px; background: var(--primary);   top: -150px;   left: -150px; }
.orb2 { width: 350px; height: 350px; background: var(--secondary); bottom: -100px; right: -100px; animation-delay: -10s; }
.orb3 { width: 300px; height: 300px; background: var(--accent);    top: 50%;      right: -80px;  animation-delay: -5s; }

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(40px, -60px) scale(1.1); }
    66%       { transform: translate(-20px, 40px) scale(0.9); }
}

/* ============================================================
   AUTH LAYOUT (login / register)
   ============================================================ */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 460px;
    padding: 2rem 1rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo a {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: 4px;
}

.auth-card {
    background: rgba(13, 13, 24, 0.85);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    padding: 3rem 2.5rem;
}

.auth-card h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.auth-card .auth-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.auth-footer-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-footer-link a {
    color: var(--primary);
    text-decoration: none;
}

.auth-footer-link a:hover { text-decoration: underline; }

/* ============================================================
   PORTAL LAYOUT (authenticated pages)
   ============================================================ */

.portal-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ----- Sidebar -------------------------------------------- */
.portal-sidebar {
    width: var(--sidebar-w);
    background: var(--dark-mid);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 204, 0.2) transparent;
}

.sidebar-logo {
    padding: 1.2rem 1.2rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-logo a {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: 3px;
}

.sidebar-logo .sidebar-tagline {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-top: 0.25rem;
    font-family: 'JetBrains Mono', monospace;
    -webkit-text-fill-color: var(--text-muted);
}

.sidebar-nav {
    padding: 0.75rem 0;
    flex: 1;
}

.sidebar-section-label {
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    padding: 0.5rem 1.2rem 0.3rem;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 1.2rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 400;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.sidebar-link:hover {
    color: var(--text);
    background: rgba(0, 255, 204, 0.05);
    border-left-color: rgba(0, 255, 204, 0.3);
}

.sidebar-link.active {
    color: var(--primary);
    background: rgba(0, 255, 204, 0.08);
    border-left-color: var(--primary);
}

.sidebar-link svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.sidebar-link:hover svg,
.sidebar-link.active svg { opacity: 1; }

.sidebar-user {
    padding: 0.85rem 1.2rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 0.78rem;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.8rem;
}

.sidebar-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.sidebar-logout:hover { color: #ff4444; }

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 300;
    background: var(--dark-mid);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    font-size: 1.2rem;
}

/* ----- Main content area ---------------------------------- */
.portal-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.portal-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.82rem;
    color: var(--primary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.topbar-user a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8rem;
}

.topbar-user a:hover { text-decoration: underline; }

.portal-content {
    padding: 1.25rem 1.5rem;
    flex: 1;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 204, 0.2);
    color: var(--text);
    padding: 0.55rem 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    -webkit-appearance: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 255, 204, 0.1);
}

.form-control::placeholder { color: rgba(255,255,255,0.2); }

select.form-control option {
    background: var(--dark-mid);
    color: var(--text);
}

textarea.form-control { resize: vertical; min-height: 120px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* ----- Buttons -------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.8rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--dark);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,255,204,0.3); }

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-secondary:hover { background: rgba(0,255,204,0.1); }

.btn-danger {
    background: transparent;
    color: #ff4444;
    border: 1px solid #ff4444;
}
.btn-danger:hover { background: rgba(255,68,68,0.1); }

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.75rem;
}

.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   ALERTS / FLASH MESSAGES
   ============================================================ */

.alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.82rem;
    border-left: 3px solid;
}

.alert-success { background: rgba(0,255,204,0.08);  border-color: var(--primary);   color: var(--primary); }
.alert-error   { background: rgba(255,68,68,0.08);  border-color: #ff4444;          color: #ff6666; }
.alert-warning { background: rgba(240,165,0,0.08);  border-color: #f0a500;          color: #f0c040; }
.alert-info    { background: rgba(0,212,255,0.08);  border-color: var(--accent);    color: var(--accent); }

/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid var(--border);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.card-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    color: var(--primary);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ----- Stats row (dashboard) ------------------------------ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-block {
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid var(--border);
    padding: 1.1rem 1.25rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}

.stat-block:hover { border-color: var(--primary); }

.stat-block-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.7rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.3rem;
}

.stat-block-label {
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat-block-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.06;
    font-size: 4rem;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-responsive { overflow-x: auto; }

table.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.portal-table thead tr {
    border-bottom: 1px solid rgba(0, 255, 204, 0.3);
}

.portal-table th {
    padding: 0.55rem 0.85rem;
    text-align: left;
    font-size: 0.68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 400;
    white-space: nowrap;
}

.portal-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}

.portal-table tbody tr:hover { background: rgba(0,255,204,0.03); }

.portal-table .td-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ============================================================
   STATUS BADGES
   ============================================================ */

.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
    border: 1px solid;
}

.badge-active    { color: var(--status-active);    border-color: var(--status-active);    background: rgba(0,255,204,0.08); }
.badge-pending   { color: var(--status-pending);   border-color: var(--status-pending);   background: rgba(240,165,0,0.08); }
.badge-suspended { color: var(--status-suspended); border-color: var(--status-suspended); background: rgba(255,68,68,0.08); }
.badge-cancelled { color: var(--status-cancelled); border-color: var(--status-cancelled); background: rgba(136,136,136,0.08); }
.badge-paid      { color: var(--status-paid);      border-color: var(--status-paid);      background: rgba(0,255,204,0.08); }
.badge-unpaid    { color: var(--status-unpaid);    border-color: var(--status-unpaid);    background: rgba(240,165,0,0.08); }
.badge-open      { color: var(--status-open);      border-color: var(--status-open);      background: rgba(0,212,255,0.08); }
.badge-closed    { color: var(--status-closed);    border-color: var(--status-closed);    background: rgba(136,136,136,0.08); }
.badge-answered  { color: var(--status-answered);  border-color: var(--status-answered);  background: rgba(0,255,204,0.08); }
.badge-in_progress { color: var(--accent); border-color: var(--accent); background: rgba(0,212,255,0.08); }
.badge-refunded  { color: #aaa; border-color: #aaa; background: rgba(170,170,170,0.08); }

/* ============================================================
   PRODUCT CARDS (order page)
   ============================================================ */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.product-card {
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid var(--border);
    padding: 2rem 1.5rem;
    position: relative;
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,255,204,0.15);
}

.product-card.featured {
    border-color: var(--primary);
    background: rgba(0, 255, 204, 0.04);
}

.product-card-badge {
    position: absolute;
    top: -1px;
    right: 1.5rem;
    background: var(--primary);
    color: var(--dark);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 0.2rem 0.7rem;
    text-transform: uppercase;
}

.product-type-tag {
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.product-card h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.product-price {
    font-size: 2rem;
    font-weight: 900;
    margin: 1rem 0;
    color: var(--text);
}

.product-price .price-cycle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

.product-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    flex: 1;
}

.product-card-footer {
    margin-top: auto;
}

/* Section headings within portal content */
.category-heading {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin: 2rem 0 1.25rem;
}

/* ============================================================
   TICKET THREAD
   ============================================================ */

.ticket-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    font-size: 0.82rem;
}

.ticket-meta span { color: var(--text-muted); }
.ticket-meta strong { color: var(--text); }

.ticket-thread { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }

.ticket-reply {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    padding: 1.25rem;
}

.ticket-reply.staff-reply {
    border-color: rgba(0,212,255,0.3);
    background: rgba(0,212,255,0.03);
}

.reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.reply-header .reply-author { font-weight: 600; color: var(--text); }
.ticket-reply.staff-reply .reply-author { color: var(--accent); }

.reply-body {
    font-size: 0.88rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ============================================================
   MISC UTILS
   ============================================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: var(--text);
    letter-spacing: 2px;
}

.text-muted    { color: var(--text-muted); }
.text-primary  { color: var(--primary); }
.text-accent   { color: var(--accent); }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.mt-1          { margin-top: 0.5rem; }
.mt-2          { margin-top: 1rem; }
.mt-3          { margin-top: 1.5rem; }
.mb-2          { margin-bottom: 1rem; }
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* Invoice specific */
.invoice-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
.invoice-to-label, .invoice-details-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.invoice-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    color: var(--primary);
}
.invoice-total-row td {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
    border-top: 1px solid rgba(0,255,204,0.3) !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
    .portal-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .portal-sidebar.open { transform: translateX(0); }
    .portal-main { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .portal-topbar { padding-left: 3.5rem; }
    .form-row { grid-template-columns: 1fr; }
    .invoice-header { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .portal-content { padding: 1rem; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .product-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 2rem 1.25rem; }
}
