/* ───────────────────────────────────────────────────────────── */
/*  ADD SERVER MODAL — Dark Tactical Theme                      */
/* ───────────────────────────────────────────────────────────── */

/* ── Overlay ─────────────────────────────────────────────────── */

.asm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(var(--so-black-rgb),0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.asm-overlay.asm-open {
    opacity: 1;
    visibility: visible;
}

/* ── Modal Container ─────────────────────────────────────────── */

.asm-modal {
    background: #1a1410;
    border: 1px solid rgba(var(--so-accent-rgb),0.2);
    border-radius: 16px;
    width: 560px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(30px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow:
        0 0 0 1px rgba(var(--so-accent-rgb),0.08),
        0 25px 80px rgba(var(--so-black-rgb),0.6);
}

.asm-overlay.asm-open .asm-modal {
    transform: translateY(0) scale(1);
}

/* Custom scrollbar */
.asm-modal::-webkit-scrollbar { width: 6px; }
.asm-modal::-webkit-scrollbar-track { background: transparent; }
.asm-modal::-webkit-scrollbar-thumb {
    background: rgba(var(--so-accent-rgb),0.25);
    border-radius: 3px;
}

/* ── Header ──────────────────────────────────────────────────── */

.asm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 0;
}

.asm-title {
    font-family: 'Teko', sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #f0e6d6;
    margin: 0;
}

.asm-close-btn {
    background: var(--so-a06);
    border: 1px solid var(--so-a08);
    color: #a09080;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.asm-close-btn:hover {
    background: rgba(var(--so-accent-rgb),0.12);
    border-color: rgba(var(--so-accent-rgb),0.3);
    color: var(--so-accent);
}

/* ── Step Indicator ──────────────────────────────────────────── */

.asm-steps {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 20px 28px 0;
}

.asm-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.asm-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--so-a12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Teko', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--so-a25);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.asm-step.active .asm-step-dot {
    border-color: var(--so-accent);
    background: var(--so-accent);
    color: #1a1410;
}

.asm-step.done .asm-step-dot {
    border-color: #3aa66a;
    background: #3aa66a;
    color: var(--so-text-max);
}

.asm-step-label {
    font-family: 'Teko', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--so-a25);
    transition: color 0.3s ease;
}

.asm-step.active .asm-step-label {
    color: var(--so-accent);
}

.asm-step.done .asm-step-label {
    color: #3aa66a;
}

.asm-step-line {
    flex: 1;
    height: 1px;
    background: var(--so-a08);
    margin: 0 8px;
}

.asm-step.done + .asm-step-line,
.asm-step-line.done {
    background: #3aa66a;
}

/* ── Body / Steps ────────────────────────────────────────────── */

.asm-body {
    padding: 24px 28px 28px;
}

.asm-step-panel {
    display: none;
}

.asm-step-panel.active {
    display: block;
    animation: asmFadeIn 0.3s ease;
}

@keyframes asmFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Form Fields ─────────────────────────────────────────────── */

.asm-field {
    margin-bottom: 16px;
}

.asm-label {
    display: block;
    font-family: 'Teko', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a09080;
    margin-bottom: 6px;
}

.asm-label .asm-required {
    color: var(--so-accent);
    margin-left: 2px;
}

.asm-input,
.asm-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--so-a04);
    border: 1px solid var(--so-a10);
    border-radius: 8px;
    color: #f0e6d6;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
}

.asm-input::placeholder {
    color: var(--so-a20);
}

.asm-input:focus,
.asm-select:focus {
    outline: none;
    border-color: var(--so-accent);
    background: rgba(var(--so-accent-rgb),0.04);
}

.asm-input.error,
.asm-select.error {
    border-color: #e04444;
}

.asm-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a09080' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.asm-select option {
    background: #1a1410;
    color: #f0e6d6;
}

.asm-hint {
    font-size: 0.8rem;
    color: #6b5b4b;
    margin-top: 4px;
}

/* Row layout for host + port */
.asm-row {
    display: flex;
    gap: 12px;
}

.asm-row .asm-field {
    flex: 1;
}

.asm-row .asm-field.port-field {
    flex: 0 0 110px;
}

/* Protocol visual pills */
.asm-protocol-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.asm-protocol-pill {
    flex: 1;
    padding: 10px 8px;
    background: var(--so-a04);
    border: 1px solid var(--so-a10);
    border-radius: 8px;
    color: #a09080;
    font-family: 'Teko', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.asm-protocol-pill:hover {
    border-color: rgba(var(--so-accent-rgb),0.3);
    color: #f0e6d6;
}

.asm-protocol-pill.active {
    border-color: var(--so-accent);
    background: rgba(var(--so-accent-rgb),0.12);
    color: var(--so-accent);
}

.asm-protocol-pill .pill-sub {
    display: block;
    font-family: inherit;
    font-size: 0.65rem;
    text-transform: none;
    letter-spacing: 0;
    color: #6b5b4b;
    margin-top: 2px;
}

.asm-protocol-pill.active .pill-sub {
    color: rgba(var(--so-accent-rgb),0.6);
}

/* FTPS mode sub-selector */
.asm-ftps-mode {
    display: none;
    gap: 8px;
    margin-bottom: 16px;
}

.asm-ftps-mode.visible {
    display: flex;
}

.asm-ftps-pill {
    flex: 1;
    padding: 8px;
    background: var(--so-a03);
    border: 1px solid var(--so-a08);
    border-radius: 6px;
    color: #6b5b4b;
    font-size: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.asm-ftps-pill:hover {
    border-color: rgba(var(--so-accent-rgb),0.2);
    color: #a09080;
}

.asm-ftps-pill.active {
    border-color: rgba(var(--so-accent-rgb),0.5);
    background: rgba(var(--so-accent-rgb),0.08);
    color: var(--so-accent);
}

/* ── Password field with toggle ──────────────────────────────── */

.asm-password-wrap {
    position: relative;
}

.asm-password-wrap .asm-input {
    padding-right: 44px;
}

.asm-password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b5b4b;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.asm-password-toggle:hover {
    color: var(--so-accent);
}

/* ── Step 2: Test Connection ─────────────────────────────────── */

.asm-test-section {
    text-align: center;
    padding: 16px 0;
}

.asm-test-summary {
    background: var(--so-a03);
    border: 1px solid var(--so-a08);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
    text-align: left;
}

.asm-test-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.88rem;
}

.asm-test-summary-label {
    color: #6b5b4b;
}

.asm-test-summary-value {
    color: #f0e6d6;
    font-weight: 500;
}

.asm-test-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--so-accent), #e06800);
    border: none;
    border-radius: 10px;
    color: var(--so-text-max);
    font-family: 'Teko', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.25s ease;
}

.asm-test-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(var(--so-accent-rgb),0.35);
}

.asm-test-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Spinner */
.asm-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--so-a20);
    border-top-color: var(--so-text-max);
    border-radius: 50%;
    animation: asmSpin 0.7s linear infinite;
    display: none;
}

.asm-test-btn.testing .asm-spinner {
    display: block;
}

@keyframes asmSpin {
    to { transform: rotate(360deg); }
}

/* Test result feedback */
.asm-test-result {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: 10px;
    display: none;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.5;
}

.asm-test-result.visible {
    display: flex;
}

.asm-test-result.success {
    background: rgba(58,166,106,0.12);
    border: 1px solid rgba(58,166,106,0.3);
    color: #6fd99a;
}

.asm-test-result.failure {
    background: rgba(224,68,68,0.12);
    border: 1px solid rgba(224,68,68,0.3);
    color: #f09090;
}

.asm-test-result-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Step 3: Confirm + Save ──────────────────────────────────── */

.asm-confirm-section {
    text-align: center;
}

.asm-confirm-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.asm-confirm-heading {
    font-family: 'Teko', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #3aa66a;
    margin: 0 0 4px;
}

.asm-confirm-sub {
    font-size: 0.9rem;
    color: #a09080;
    margin: 0 0 20px;
}

.asm-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    background: linear-gradient(135deg, #3aa66a, #2d8a56);
    border: none;
    border-radius: 10px;
    color: var(--so-text-max);
    font-family: 'Teko', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.25s ease;
}

.asm-save-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(58,166,106,0.35);
}

.asm-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.asm-save-error {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(224,68,68,0.12);
    border: 1px solid rgba(224,68,68,0.3);
    color: #f09090;
    font-size: 0.85rem;
    display: none;
}

.asm-save-error.visible {
    display: block;
}

/* ── Footer / Navigation ─────────────────────────────────────── */

.asm-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 28px 24px;
}

.asm-back-btn {
    background: none;
    border: none;
    color: #a09080;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.asm-back-btn:hover {
    color: var(--so-accent);
}

.asm-next-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--so-accent), #e06800);
    border: none;
    border-radius: 8px;
    color: var(--so-text-max);
    font-family: 'Teko', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.25s ease;
}

.asm-next-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--so-accent-rgb),0.3);
}

.asm-next-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Game Host Dropdown ──────────────────────────────────────── */

.asm-host-option-custom {
    font-style: italic;
    color: #6b5b4b;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 600px) {
    .asm-modal {
        width: 100%;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .asm-header { padding: 16px 20px 0; }
    .asm-body { padding: 20px; }
    .asm-footer { padding: 0 20px 20px; }
    .asm-steps { padding: 16px 20px 0; }

    .asm-protocol-group {
        flex-wrap: wrap;
    }

    .asm-protocol-pill {
        flex: 1 1 calc(50% - 4px);
    }

    .asm-row {
        flex-direction: column;
        gap: 0;
    }

    .asm-row .asm-field.port-field {
        flex: 1;
    }

    .asm-step-label {
        display: none;
    }
}
