/* GT Admin — minimal styles + responsive */

/* Sidebar: fixed on md+, offcanvas on mobile */
/* Main content — never wider than viewport */
.main-content {
    min-width: 0;
    overflow-x: hidden;
    background: #f8f9fa;
    min-height: 100vh;
}

@media (min-width: 768px) {
    .offcanvas-md {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
    }
    .main-content {
        margin-left: 220px;
    }
}

/* Page header */
.page-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}
.page-subtitle {
    font-size: .78rem;
    color: var(--gt-text-secondary);
    margin: 0;
}

/* Cards */
.gt-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    padding: 1rem;
}

.gt-card-flush {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    overflow: hidden;
}

/* Prevent pre/code content from blowing out grid columns */
.row > [class*="col-"] {
    min-width: 0;
    overflow: hidden;
}

/* Stat cards */
.stat-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    padding: 1rem;
    border-left: 4px solid #dee2e6;
}

.stat-card-blue   { border-left-color: #0d6efd; }
.stat-card-green  { border-left-color: #198754; }
.stat-card-purple { border-left-color: #6f42c1; }
.stat-card-red    { border-left-color: #dc3545; }

.stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: .5rem;
}

.stat-icon-blue   { background: #0d6efd; }
.stat-icon-green  { background: #198754; }
.stat-icon-purple { background: #6f42c1; }
.stat-icon-red    { background: #dc3545; }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: .75rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: .25rem;
}

.stat-sub {
    font-size: .875rem;
    font-weight: 400;
    color: #6c757d;
}

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    flex-wrap: wrap;
    gap: .5rem;
}

.section-title {
    font-size: .875rem;
    font-weight: 700;
    margin: 0;
}

/* Tables — horizontally scrollable on mobile */
.gt-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
    min-width: 500px;
}

.gt-table thead th {
    background: #f8f9fa;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: .6rem .75rem;
    border-bottom: 2px solid #dee2e6;
    text-align: left;
    white-space: nowrap;
}

.gt-table thead th.text-center { text-align: center; }

.gt-table tbody td {
    padding: .6rem .75rem;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.gt-table tbody tr:hover td {
    background: #f8f9fa;
}

.gt-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status dots */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.status-online  { background: #198754; }
.status-offline { background: #adb5bd; }

/* Badges */
.gt-badge {
    display: inline-block;
    border-radius: .25rem;
    font-weight: 700;
    font-size: .7rem;
    padding: .15rem .5rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.gt-badge-success   { background: #d1e7dd; color: #0f5132; }
.gt-badge-danger    { background: #f8d7da; color: #842029; }
.gt-badge-warning   { background: #fff3cd; color: #664d03; }
.gt-badge-info      { background: #cff4fc; color: #055160; }
.gt-badge-light     { background: #e9ecef; color: #495057; }
.gt-badge-secondary { background: #e9ecef; color: #6c757d; }

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .875rem;
    color: #6c757d;
    text-decoration: none;
    margin-bottom: 1rem;
}

.back-link:hover { color: #0d6efd; }
.back-link i.fa-solid { font-size: .875rem; }

/* Log viewer */
.log-viewer {
    background: #212529;
    color: #adb5bd;
    padding: .75rem;
    border-radius: .375rem;
    max-height: 300px;
    overflow: auto;
    font-size: .75rem;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

.log-viewer-flush {
    background: #212529;
    color: #adb5bd;
    padding: .75rem;
    max-height: 250px;
    overflow: auto;
    font-size: .75rem;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

/* VPS cards */
/* VPS Stat Boxes */
.vps-stat-box {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: #fff;
    border: 1px solid #dee2e6;
    padding: .5rem .75rem;
}
.vps-stat-box i { font-size: .9rem; flex-shrink: 0; }
.vps-stat-content { display: flex; flex-direction: column; min-width: 0; }
.vps-stat-value { font-size: .88rem; font-weight: 700; color: var(--gt-text); line-height: 1.2; }
.vps-stat-muted { font-weight: 400; color: var(--gt-text-secondary); font-size: .75rem; }
.vps-stat-label { font-size: .65rem; color: var(--gt-text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: .02em; }

/* VPS Cards */
.vps-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    display: flex;
    flex-direction: column;
    height: 100%;
}
.vps-card-offline {
    opacity: .6;
}

.vps-card-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .85rem;
    background: #0d6efd;
    color: #fff;
    border-bottom: none;
}
.vps-card-icon {
    font-size: .85rem;
    color: rgba(255,255,255,.7);
    flex-shrink: 0;
}
.vps-card-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.vps-status-online { background: #2dd36f; box-shadow: 0 0 0 3px rgba(45,211,111,.25); animation: vps-pulse 2s infinite; }
.vps-status-offline { background: #ff4961; box-shadow: 0 0 0 3px rgba(255,73,97,.25); }
@keyframes vps-pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(45,211,111,.25); } 50% { box-shadow: 0 0 0 6px rgba(45,211,111,.1); } }

.vps-card-title { flex: 1; min-width: 0; }
.vps-card-name { font-size: .82rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vps-card-ip { font-size: .7rem; color: rgba(255,255,255,.6); font-family: monospace; font-weight: 500; }

.vps-card-header .gt-badge {
    font-size: .68rem;
    padding: .25rem .55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.vps-manage-btn {
    display: inline-flex;
    align-items: center;
    padding: .35rem .75rem;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,.25);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.vps-manage-btn:hover { background: rgba(255,255,255,.25); color: #fff; }

/* Metrics row (grid boxes) */
.vps-metrics-row {
    display: flex;
    gap: .5rem;
    padding: .75rem;
}
.vps-metric-col {
    flex: 1;
    text-align: center;
    padding: .7rem .5rem .6rem;
    background: #f6f8fc;
    border: 1px solid #eaeff5;
    border-radius: .45rem;
}
.vps-metric-clickable { cursor: pointer; }
.vps-metric-clickable:hover { background: #eef2f8; }
.vps-metric-icon {
    font-size: 1.1rem;
    margin-bottom: .3rem;
}
.vps-metric-label {
    font-size: .65rem;
    font-weight: 700;
    color: var(--gt-text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .3rem;
}
.vps-metric-value {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.2;
}
.vps-metric-bar {
    height: 7px;
    background: #e4e8ee;
    margin: .45rem auto 0;
    overflow: hidden;
    max-width: 85%;
    border-radius: 4px;
}
.vps-metric-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .8s ease, background .5s;
}
.vps-metric-sub {
    font-size: .7rem;
    color: var(--gt-text-secondary);
    margin-top: .3rem;
    font-weight: 500;
}
.vps-metric-net {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    font-size: .88rem;
    font-weight: 600;
    color: var(--gt-text);
    margin-top: .2rem;
}
.vps-metric-net i { font-size: .7rem; margin-right: .3rem; }

/* Disk IO row */
.vps-disk-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem 1rem;
    border-top: 1px solid var(--gt-border);
    background: #fff;
    font-size: .8rem;
    color: var(--gt-text-secondary);
}
.vps-disk-item { font-weight: 600; color: var(--gt-text); }
.vps-disk-item i { font-size: .75rem; margin-right: .25rem; }
.vps-disk-sep {
    width: 1px;
    height: 16px;
    background: var(--gt-border);
}

.vps-card-offline-msg {
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: .85rem;
    color: #dc3545;
    font-weight: 600;
}


/* Login page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    background: #212529;
}

.login-left {
    flex: 0 0 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: white;
}

.login-left-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.login-left-icon {
    width: 3rem; height: 3rem; border-radius: 50%;
    background: rgba(255,255,255,.15);
    display: flex; align-items: center; justify-content: center;
    color: white;
}
.login-left h1 { font-size: 1.5rem; font-weight: 700; margin: 0; color: white; }
.login-left p { color: rgba(255,255,255,.5); font-size: .9rem; text-align: center; }

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 1.5rem;
}

.login-form-wrapper { width: 100%; max-width: 22rem; }
.login-form-wrapper h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: .25rem; }
.login-form-wrapper .login-sub { color: #6c757d; margin-bottom: 1.5rem; }

@media (max-width: 768px) {
    .login-left { display: none; }
    .login-right { border-radius: 0; }
}

/* Info list */
.info-list { font-size: .875rem; line-height: 2; }
.info-list strong { font-weight: 700; display: inline-block; min-width: 5rem; }

@media (max-width: 576px) {
    .info-list strong { min-width: auto; margin-right: .25rem; }
}

/* Wizard stepper */
.wizard-steps {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--gt-border);
    border-radius: .5rem;
    padding: .75rem 1rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    padding: .25rem .5rem;
    cursor: pointer;
    flex-shrink: 0;
    min-width: 70px;
    transition: all .2s;
}

.wizard-step-num {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #e9ecef;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    color: #6c757d;
    transition: all .25s;
}

.wizard-step-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .1rem;
    font-size: .7rem;
    font-weight: 600;
    color: #adb5bd;
    text-align: center;
    white-space: nowrap;
    transition: color .2s;
}

.wizard-step-icon { font-size: .65rem; }
.wizard-step-label span { font-size: .72rem; }

/* Line connector between steps */
.wizard-step-line {
    flex: 1;
    height: 2px;
    background: #dee2e6;
    min-width: 20px;
    margin: 0 .15rem;
    margin-bottom: 1.8rem; /* align with circle center */
    transition: background .3s;
}
.wizard-step-line.completed { background: #198754; }

/* Hover */
.wizard-step:hover .wizard-step-num {
    border-color: #adb5bd;
    background: #f8f9fa;
}

/* Active step */
.wizard-step.active .wizard-step-num {
    background: #0d6efd;
    border-color: #0d6efd;
    color: white;
    box-shadow: 0 0 0 4px rgba(13,110,253,.15);
}
.wizard-step.active .wizard-step-label { color: #0d6efd; }
.wizard-step.active .wizard-step-icon { color: #0d6efd; }

/* Completed step */
.wizard-step.completed .wizard-step-num {
    background: #198754;
    border-color: #198754;
    color: white;
}
.wizard-step.completed .wizard-step-label { color: #198754; }
.wizard-step.completed .wizard-step-icon { color: #198754; }
.wizard-step.completed:hover .wizard-step-num {
    background: #157347;
    border-color: #157347;
}

/* Spinner */
.spinner-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

/* Active sidebar link */
.nav-pills .nav-link.active {
    background-color: rgba(255,255,255,.15);
}

/* Modal — full screen on small devices */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }
    .modal-content {
        border: 0;
        border-radius: 0;
        min-height: 100vh;
    }
}

/* Log group header */
.log-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .6rem 1rem;
    margin-bottom: .5rem;
    background: #1a1a2e;
    color: #e0e0e0;
    border-radius: .375rem;
    cursor: pointer;
    transition: background .15s;
}

.log-group-header:hover {
    background: #222240;
}

/* Log terminal */
.log-terminal {
    background: #1a1a2e;
    color: #a8d8a8;
    padding: .5rem;
    max-height: calc(100vh - 300px);
    min-height: 150px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    font-size: .65rem;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    margin: 0;
    line-height: 1.35;
    border-top: none;
    min-width: 0;
    max-width: 100%;
}

.log-terminal.log-nowrap {
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
}

.log-terminal-mini {
    max-height: 200px;
    min-height: 100px;
}

.log-terminal-grid {
    height: 300px;
    max-height: 300px;
    min-height: 300px;
}

.log-terminal-expanded {
    height: 80vh;
    max-height: 80vh;
    min-height: 80vh;
}

.log-expand-btn {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(130,170,255,.3);
    color: #82aaff;
    border-radius: .375rem;
    padding: .3rem;
    cursor: pointer;
    line-height: 1;
    z-index: 2;
    opacity: .6;
    transition: all .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.log-expand-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,.65);
    border-color: rgba(130,170,255,.5);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.log-terminal-wrap {
    position: relative;
}

/* Blazor error */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: .75rem;
    top: .5rem;
}

/* Toast notifications */
.toast-container-gt {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
}

.toast-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    border-radius: .375rem;
    font-size: .8rem;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    pointer-events: auto;
    animation: toastIn .3s ease;
    min-width: 220px;
    max-width: 360px;
}

.toast-item.toast-hide {
    animation: toastOut .3s ease forwards;
}

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg { flex: 1; }

.toast-success { background: #198754; }
.toast-error   { background: #dc3545; }
.toast-warning { background: #ffc107; color: #212529; }
.toast-info    { background: #0dcaf0; color: #212529; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(30px); }
}

/* Sidebar body — width via CSS instead of inline style */
.sidebar-body {
    width: 220px;
    overflow-y: auto;
}

/* =============================================
   RESPONSIVE — Mobile (<768px)
   ============================================= */
@media (max-width: 767.98px) {

    /* Sidebar: full-width on mobile */
    .sidebar-body {
        width: 100% !important;
    }

    /* A. Table-to-Card on mobile */
    .gt-table-wrap {
        overflow-x: visible !important;
    }

    table.gt-table-responsive {
        display: block !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    .gt-table-responsive thead {
        display: none !important;
    }

    .gt-table-responsive tbody {
        display: block !important;
    }

    .gt-table-responsive tbody tr {
        display: block !important;
        background: #fff;
        border: 1px solid #dee2e6;
        border-radius: .375rem;
        padding: .75rem;
        margin-bottom: .75rem;
    }

    .gt-table-responsive tbody tr:hover td {
        background: transparent;
    }

    .gt-table-responsive tbody td {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: .3rem 0 !important;
        border-bottom: 1px solid #f0f0f0;
        font-size: .875rem;
        text-align: right;
        width: 100% !important;
    }

    .gt-table-responsive tbody td:last-child {
        border-bottom: none;
    }

    .gt-table-responsive tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: .75rem;
        text-transform: uppercase;
        color: #6c757d;
        flex-shrink: 0;
        margin-right: .75rem;
        text-align: left;
    }

    .gt-table-responsive tbody td.td-actions {
        justify-content: flex-end;
        padding-top: .5rem !important;
    }

    .gt-table-responsive tbody td.td-actions::before {
        display: none;
    }

    /* B. Touch-friendly sizing */
    .btn-sm {
        min-height: 38px;
        padding: .4rem .75rem;
        font-size: .875rem;
    }

    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 1rem;
    }

    .form-check-input {
        width: 2.5em;
        height: 1.25em;
    }

    /* C. Page header stacks on mobile */
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header .btn,
    .page-header a.btn {
        width: 100%;
        text-align: center;
    }

    /* D. Stat cards smaller text */
    .stat-value {
        font-size: 1.25rem;
    }

    /* E. Log viewers shorter */
    .log-viewer,
    .log-viewer-flush {
        max-height: 200px;
    }

    .log-terminal-grid {
        height: 200px;
        max-height: 200px;
        min-height: 200px;
    }

    .log-terminal-expanded {
        height: 70vh;
        max-height: 70vh;
        min-height: 70vh;
    }

    .log-terminal {
        font-size: .6rem;
    }

    /* F. Login form full-width */
    .login-form-wrapper {
        max-width: 100%;
        padding: 0 1rem;
    }

    /* G. Section header wraps better */
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
    }

    /* Keep log card headers horizontal on mobile */
    .section-header.section-header-inline {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .section-header .form-select {
        width: 100% !important;
    }

    /* H. Migration arrow rotates on stacked layout */
    .migration-arrow {
        transform: rotate(90deg);
    }

    /* I. Wizard steps: compact on tablet */
    .wizard-step { min-width: 55px; padding: .2rem .25rem; }
    .wizard-step-num { width: 2rem; height: 2rem; font-size: .75rem; }
    .wizard-step-label span { font-size: .65rem; }
    .wizard-step-line { min-width: 12px; }
}

/* =============================================
   RESPONSIVE — Small (<576px)
   ============================================= */
@media (max-width: 575.98px) {

    /* Wizard steps: smaller on mobile */
    .wizard-steps { padding: .5rem; }
    .wizard-step { min-width: 40px; padding: .15rem .1rem; gap: .2rem; }
    .wizard-step-num { width: 1.6rem; height: 1.6rem; font-size: .65rem; border-width: 1.5px; }
    .wizard-step-label span { font-size: .58rem; }
    .wizard-step-icon { display: none; }
    .wizard-step-line { min-width: 8px; margin-bottom: 1.2rem; }
    .wizard-step.active .wizard-step-num { box-shadow: 0 0 0 3px rgba(13,110,253,.12); }
}
