/* ===== IFS Light Theme ===== */
:root {
    --ifs-purple: #6a1b9a;
    --ifs-purple-dark: #360065;
    --ifs-accent: #7d3bb5;
    --bg: #f7f7fb; /* page background */
    --panel: #ffffff; /* cards/panels */
    --text: #1f2937; /* body text */
    --muted: #6b7280; /* muted text */
    --link: #2563eb; /* links */
    --border: #e5e7eb; /* borders/dividers */

    --ok: #16a34a;
    --bad: #ef4444;
    --warn: #f59e0b;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Ubuntu,Cantarell,"Noto Sans","Helvetica Neue",Arial,"Apple Color Emoji","Segoe UI Emoji";
}

a {
    color: var(--link);
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

/* ===== Shell ===== */
.app-container {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    color: #fff;
    background: var(--ifs-purple-dark);
    height: 50px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .brand .logo {
        width: 45px;
        height: 45px;
    }

    .brand .title {
        font-weight: 700;
        letter-spacing: .2px;
    }

.header-actions .btn {
    color: #fff;
    border: 1px solid #ffffff44;
    padding: 8px 14px;
    border-radius: 10px;
    text-decoration: none;
    margin-left: 8px;
    margin-right: 8px;
}

.app-main {
    padding: clamp(16px,3vw,32px);
}

.app-footer {
    padding: 12px 18px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: #fafafa;
}


.card {
    background: var(--panel);
    border: 1.5px solid #d1d5db;
    border-radius: 14px;
    padding: clamp(18px,2.5vw,24px);
    box-shadow: 0 4px 12px rgba(17,24,39,.04);
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2,minmax(0,1fr));
    align-items: stretch; /* equal column height */
}

.grid-3 {
    grid-template-columns: repeat(3,minmax(0,1fr));
}

/* key-value layout */
.kv {
    display: grid;
    grid-template-columns: minmax(180px, 240px) 1fr; /* label can shrink */
    gap: 12px 16px;
    align-items: center;
}

    .kv .label {
        color: var(--muted);
        font-weight: 600;
    }

    /* let grid cells actually shrink */
    .kv > div {
        min-width: 0;
    }

/* sub-panels inside Training Environment */
.env-subgroup {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    margin-top: 14px;
    border-top: 1px dashed var(--border);
    height: 100%; /* fill column -> equal height */
}

/* columns inside Training Environment */
.env-column {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* value boxes (host/user/pass) */
.value-box {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    height: 52px; /* match .input */
    padding: 0 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #fff;
}

    .value-box .text-clip {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1 1 auto;
    }

/* password input embedded in value box */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
}

.value-input {
    border: none;
    outline: none;
    width: 100%;
    background: transparent;
    height: 100%;
    line-height: normal;
    padding: 0 80px 0 0; /* leave space for copy + eye icons */
    box-sizing: border-box;
}

/* small icon buttons */
.icon-btn {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #4b5563;
}

    .icon-btn:hover {
        color: #111827;
    }

    .icon-btn img {
        display: inline-block;
        width: 18px;
        height: 18px;
        vertical-align: middle;
    }

/* copy + eye positioning for password */
.copy-btn {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
}

.eye-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
}

    .eye-btn.active {
        color: var(--ifs-purple);
    }

/* right-aligned row content in kv */
.kv .right-align {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

/* Start/Stop pinned to bottom + right */
.status-footer {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Inputs & buttons */
.input, select, textarea {
    width: 100%;
    background: #fff;
    border: 2px solid #cbd5e1;
    color: #111827;
    height: 52px;
    font-size: 18px;
    line-height: 52px;
    padding: 0 16px;
    border-radius: 14px;
    display: block;
    box-sizing: border-box;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.05);
}

    .input:focus, select:focus, textarea:focus {
        outline: 2px solid #c7b8e4;
        border-color: #c7b8e4;
    }

    .input::placeholder {
        color: #9ca3af;
    }

.button {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 16px;
    width: auto;
}

    .button.primary {
        background: var(--ifs-purple);
        color: #fff;
        border-color: transparent;
    }

    .button.ghost {
        background: transparent;
        border-color: var(--border);
    }

    .button.ok {
        background: var(--ok);
        color: #fff;
        border-color: transparent;
    }

    .button.bad {
        background: var(--bad);
        color: #fff;
        border-color: transparent;
    }

    .button:disabled {
        opacity: .6;
        cursor: not-allowed;
    }

/* Status chips */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    font-weight: 600;
    min-width: 130px; /* uniform width */
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
    display: inline-block;
}

    .dot.ok {
        background: var(--ok);
    }

    .dot.bad {
        background: var(--bad);
    }

/* ===== Login page ===== */
.login-wrap {
    min-height: 76vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.login-card {
    width: 100%;
    max-width: 720px;
    min-height: 520px;
    padding: 36px;
    display: flex;
    flex-direction: column;
    overflow: visible;
    box-sizing: border-box;
}

.login-logo {
    width: 248px;
    height: 90px;
    border-radius: 0;
    margin: 0 auto 18px;
    background: transparent;
    color: #4a1370;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .login-logo img {
        width: 248px;
        height: 90px;
    }

.login-title {
    text-align: center;
    margin-bottom: 14px;
    font-size: clamp(18px,2.2vw,22px);
    font-weight: 700;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-top: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

label {
    font-weight: 600;
    color: var(--text);
}

.form-actions {
    margin-top: 8px;
}

.btn-login {
    width: 100%;
    min-height: 54px;
    padding: 14px 16px;
    font-size: 18px;
    font-weight: 700;
}

/* Show password row (simple checkbox under the input) */
.showpass-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    margin-top: 6px;
}

/* Headings in cards */
.card h3, .card h4 {
    margin: 0 0 14px 0;
    font-weight: 700;
    color: var(--text);
}

.card h3 {
    font-size: 20px;
}

.card h4 {
    font-size: 18px;
}

.grid.grid-2 > .card {
    padding: 20px 22px;
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    border-top-color: var(--ifs-purple);
    animation: spin .9s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Page overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
}

.loading-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 10px 30px rgba(17,24,39,.18);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

/* ===== Utilities ===== */
.center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.m-0 {
    margin: 0;
}

/* ===== Modal (centered, blocks background) ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 120;
}

.modal-card {
    background: #fff;
    border: 1.5px solid #d1d5db;
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: 0 10px 30px rgba(17,24,39,.18);
    width: min(520px, calc(100vw - 32px));
    max-width: 520px;
}

.modal-title {
    margin: 0 0 8px 0;
    font-weight: 700;
    color: var(--text);
    font-size: 18px;
}

.modal-message {
    margin: 0 0 16px 0;
    color: var(--text);
}

.modal-actions {
    margin-top: 6px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---------- How-to Guide modal (reuses your modal-backdrop look) ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45); /* a bit darker for video focus */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 120; /* above page content */
}

/* Main card container for the video modal */
.modal.guide-modal {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    width: min(920px, 92vw);
    max-height: 88vh;
    box-shadow: 0 12px 36px rgba(17,24,39,.22);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Header row with title + Close */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Keep video nicely contained */
.video-wrap {
    display: block;
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
    border-radius: 12px;
}
/* ===== Responsive ===== */
@media (max-width:960px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .kv {
        grid-template-columns: 1fr;
    }
}

@media (max-width:1200px) {
    .kv {
        grid-template-columns: minmax(160px, 220px) 1fr;
    }
}
