/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    z-index: 50;
    overflow-y: auto;
}

.sidebar__logo {
    margin-bottom: 10px;
}

.sidebar__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 30px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--btn-radius);
    font-size: 15px;
    color: var(--text-secondary);
    transition: all 0.2s;
    text-decoration: none;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.sidebar__link--active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.sidebar__link .material-symbols-outlined {
    font-size: 20px;
}

.sidebar__user {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 20px;
}

.sidebar__email {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__logout {
    font-size: 14px;
    color: var(--text-muted);
    padding: 8px 0;
    width: 100%;
    text-align: left;
}

.sidebar__logout:hover {
    color: #f44336;
}

/* Sidebar toggle for mobile */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 60;
    width: 44px;
    height: 44px;
    border-radius: var(--btn-radius);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sidebar-toggle .material-symbols-outlined {
    font-size: 24px;
    color: var(--text-primary);
}

/* ===== Main Dashboard ===== */
.dashboard {
    margin-left: 260px;
    padding: 40px;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.3s;
}

.dash-title {
    font-size: 28px;
    font-weight: 300;
    margin-bottom: 32px;
}

.dash-subtitle {
    font-size: 20px;
    font-weight: 300;
    margin: 32px 0 16px;
}

/* ===== Stat Cards Grid ===== */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.dash-stat-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-stat-card__label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dash-stat-card__value {
    font-size: 30px;
    font-weight: 300;
}

/* ===== Tables ===== */
.dash-table-wrapper {
    overflow-x: auto;
    border-radius: var(--card-radius);
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.dash-table th {
    text-align: left;
    padding: 14px 16px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 400;
    white-space: nowrap;
}

.dash-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dash-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* ===== Plan Cards ===== */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.plan-card {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.plan-card__type {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.plan-card__name {
    font-size: 22px;
    font-weight: 400;
}

.plan-card__price {
    font-size: 36px;
    font-weight: 300;
}

.plan-card__detail {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.plan-card__features {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.plan-card__features li::before {
    content: '✓ ';
    color: var(--primary);
}

/* ===== Key Cards ===== */
.key-card {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.key-card__info {
    flex: 1;
    min-width: 0;
}

.key-card__uuid {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.key-card__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.key-card__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ===== Subscription Cards ===== */
.sub-card {
    padding: 24px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    position: relative;
}

.sub-card__delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.sub-card:hover .sub-card__delete {
    opacity: 1;
}

.sub-card__delete:hover {
    background: rgba(244, 67, 54, 0.3);
}

.sub-card__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sub-card__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.sub-card__meta {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== Subscription URL Card ===== */
.sub-url-card {
    padding: 24px;
    margin-top: 24px;
}

.sub-url-card h3 {
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 16px;
}

.sub-url__row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.sub-url__row .form-input {
    flex: 1;
    font-family: monospace;
    font-size: 13px;
}

.qr-container {
    display: flex;
    justify-content: center;
    padding: 16px;
}

.qr-container img {
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}

/* ===== Balance Card ===== */
.balance-card {
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.balance-card__amount {
    font-size: 48px;
    font-weight: 300;
}

/* ===== Promo / Bonus Section ===== */
.promo-section {
    padding: 24px;
    margin-bottom: 16px;
}

.promo-section h3 {
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 16px;
}

.promo-section__row {
    display: flex;
    gap: 12px;
}

.promo-section__row .form-input {
    flex: 1;
}

/* ===== Ticket Cards ===== */
.ticket-card {
    padding: 20px 24px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.ticket-card:hover {
    background: rgba(255, 255, 255, 0.03);
}

.ticket-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.ticket-card__subject {
    font-size: 16px;
    font-weight: 400;
}

.ticket-card__status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
}

.ticket-card__status--open {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.ticket-card__status--closed {
    background: rgba(158, 158, 158, 0.2);
    color: #9e9e9e;
}

.ticket-card__date {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Ticket Detail ===== */
.ticket-detail__subject {
    font-size: 22px;
    font-weight: 400;
    margin-bottom: 24px;
}

.ticket-detail__back {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: inline-block;
    cursor: pointer;
}

.ticket-detail__back:hover {
    color: var(--text-primary);
}

.ticket-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 8px;
}

.ticket-msg {
    padding: 16px;
    border-radius: var(--btn-radius);
    max-width: 80%;
}

.ticket-msg--user {
    background: rgba(255, 255, 255, 0.06);
    align-self: flex-end;
}

.ticket-msg--admin {
    background: rgba(33, 150, 243, 0.12);
    align-self: flex-start;
}

.ticket-msg__body {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 4px;
}

.ticket-msg__meta {
    font-size: 12px;
    color: var(--text-muted);
}

.ticket-reply {
    display: flex;
    gap: 12px;
}

.ticket-reply .form-textarea {
    flex: 1;
    min-height: 80px;
}

/* ===== Quick Actions ===== */
.dash-quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

/* ===== Empty State ===== */
.dash-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 15px;
}

/* ===== Small Button ===== */
.btn--sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar--open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .dashboard {
        margin-left: 0;
        padding: 70px 20px 20px;
    }

    .balance-card {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .key-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .sub-url__row {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .dash-stats {
        grid-template-columns: 1fr;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }

    .ticket-reply {
        flex-direction: column;
    }

    .promo-section__row {
        flex-direction: column;
    }

    .network-charts {
        grid-template-columns: 1fr;
    }
}

/* ===== Network Charts ===== */
.network-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.network-charts__item {
    padding: 24px;
}

.network-charts__title {
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.network-charts__canvas-wrap {
    height: 260px;
    position: relative;
}

/* Network stat cards */
.network-stat-value {
    font-size: 24px;
    font-weight: 300;
}

.network-stat-value--green { color: #4caf50; }
.network-stat-value--blue { color: #2196f3; }
.network-stat-value--orange { color: #ff9800; }
.network-stat-value--cyan { color: #00bcd4; }

/* Load bar */
.load-bar {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    margin-top: 8px;
    overflow: hidden;
}

.load-bar__fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.load-bar__fill--green { background: #4caf50; }
.load-bar__fill--orange { background: #ff9800; }
.load-bar__fill--red { background: #f44336; }

.network-stat-value--red { color: #f44336; }

/* Accent color vars */
:root {
    --accent-green: #4caf50;
    --accent-blue: #2196f3;
    --accent-orange: #ff9800;
    --accent-cyan: #00bcd4;
    --accent-red: #f44336;
    --accent-purple: #9c27b0;
}

/* Node metric cards */
.node-metric {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
}

.node-metric__label {
    font-size: 11px;
    color: var(--text-secondary, rgba(255,255,255,0.5));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.node-metric__value {
    font-size: 20px;
    font-weight: 300;
    color: var(--text-primary, #fff);
    line-height: 1.2;
}

.node-metric__detail {
    font-size: 11px;
    color: var(--text-secondary, rgba(255,255,255,0.5));
    margin-top: 2px;
}

.node-metric__sub {
    font-size: 10px;
    color: var(--text-secondary, rgba(255,255,255,0.4));
}

.node-metric .load-bar {
    margin-top: 6px;
    height: 4px;
}

/* Traffic breakdown table styling */
#traffic-breakdown-table code {
    font-size: 12px;
}
