/**
 * WebRTC Calls PoC - Responsive CSS
 * Mobile-first design with large, touch-friendly buttons.
 */

:root {
    /* Brand */
    --color-primary:        #667eea;
    --color-primary-dark:   #5568d3;
    --color-secondary:      #764ba2;
    --gradient-brand:       linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);

    /* Semantic */
    --color-success:            #28a745;
    --color-success-dark:       #218838;
    --color-success-deeper:     #1e7e34;
    --color-success-bg:         #d4edda;
    --color-success-bg-strong:  #c3e6cb;
    --color-danger:             #dc3545;
    --color-danger-dark:        #c82333;
    --color-danger-text:        #d32f2f;
    --color-secondary-btn:      #6c757d;
    --color-secondary-dark:     #5a6268;

    /* Info / warning / alert accents */
    --color-info-bg:        #e7f3ff;
    --color-info-text:      #0066cc;
    --color-warning:        #ffc107;
    --color-warning-bg:     #fff3cd;
    --color-warning-text:   #856404;

    /* Primary derivatives (kept in sync with --color-primary #667eea) */
    --color-primary-overlay:    rgba(102, 126, 234, 0.15);
    --color-primary-tint:       #f0f4ff;
    --color-primary-tint-light: #f8f9ff;

    /* Neutrals */
    --color-text:           #333;
    --color-text-muted:     #666;
    --color-neutral-dark:   #495057;
    --color-border:         #dee2e6;
    --color-border-subtle:  #e9ecef;
    --color-surface:        #f8f9fa;

    /* Media */
    --color-video-bg:       #000;

    /* Structure */
    --radius-sm:            8px;
    --radius-md:            16px;
    --transition-fast:      0.2s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--gradient-brand);
    min-height: 100vh;
    padding: 20px;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
}

/* Utility */
.hidden { display: none; }

/* Visually hidden utility class for screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    overflow: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    flex: 1;
}

/* Desktop layout: 2-column grid */
@media (min-width: 1024px) {
    .container {
        max-width: 1100px;
    }

    .app-footer {
        max-width: 1100px;
    }
    
    main {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.3fr);
        align-items: start;
        gap: 32px;
        grid-template-areas:
            "status  video"
            "status  chat"
            "extra   chat";
    }

    .status-section,
    .extra-controls {
        width: 100%;
    }
    
    .video-section,
    .chat-section {
        width: 100%;
    }
}

header {
    background: var(--gradient-brand);
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Header status container */
.header-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 14px;
}

.header-status-left,
.header-status-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header-status-left span,
.header-status-right span {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    white-space: nowrap;
}

/* Header nickname — click-to-edit */
#header-nickname {
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

#header-nickname:hover {
    background: rgba(255, 255, 255, 0.28);
    text-decoration: underline;
}

.header-nickname-input {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-text);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    font: inherit;
    font-size: 14px;
    max-width: 180px;
    outline: none;
}

/* Header controls row — availability + media toggles */
.header-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    flex-wrap: wrap;
}

.header-btn {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    white-space: nowrap;
}

.header-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.28);
}

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

.header-btn.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.header-btn.btn-danger {
    background: rgba(220, 53, 69, 0.7);
    border-color: rgba(220, 53, 69, 0.9);
}

.header-btn.mode-dnd {
    background: rgba(255, 193, 7, 0.6);
    border-color: rgba(255, 193, 7, 0.8);
    color: white;
}

.header-btn.mode-private {
    background: rgba(108, 117, 125, 0.6);
    border-color: rgba(108, 117, 125, 0.8);
    color: white;
}

main {
    padding: 30px 20px;
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: 24px;
    grid-template-areas:
        "status"
        "video"
        "chat"
        "extra";
}

.status-section {
    grid-area: status;
}

.video-section {
    grid-area: video;
}

.chat-section {
    grid-area: chat;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text);
}

/* All occupied section */
.all-occupied-section {
    padding: 40px 20px;
    text-align: center;
}

.message-block {
    background: var(--color-warning-bg);
    border: 2px solid var(--color-warning);
    border-radius: var(--radius-sm);
    padding: 30px;
}

.message-block h2 {
    color: var(--color-warning-text);
    margin-bottom: 16px;
}

.message-block p {
    color: var(--color-warning-text);
    margin-bottom: 20px;
    font-size: 16px;
}

/* Slot cards (directory + trunk participants) */
.slot-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-bottom: 8px;
}

.slot-card .slot-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-neutral-dark);
}

/* Call state pill on peer cards during trunk state */
.slot-card .slot-status {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    color: var(--color-text);
    margin-bottom: 4px;
}

.slot-card .slot-status--active  { background: rgba(40, 167, 69, 0.18); color: #145c2c; }
.slot-card .slot-status--forming { background: rgba(255, 193, 7, 0.22); color: #7a5600; }
.slot-card .slot-status--hold    { background: rgba(0, 123, 255, 0.18); color: #0a3c7a; }

.status-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
}

/* Slot status styles */
.slot-card.status-taken {
    background: var(--color-success-bg);
    border-color: var(--color-success);
}

.slot-card.status-own {
    background: var(--color-success-bg-strong);
    border-color: var(--color-success-deeper);
    border-width: 2px;
}

.slot-card .card-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.slot-card.status-unavailable {
    background: var(--color-surface);
    border-color: var(--color-border);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform 0.1s;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

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

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--color-success-dark);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--color-danger-dark);
}

.btn-secondary {
    background: var(--color-secondary-btn);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-secondary-dark);
}

/* Emergency Stop Button */
.btn-emergency-stop {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-block;
    transition: transform 0.1s ease, filter 0.1s ease;
    outline: none;
}

.btn-emergency-stop:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.btn-emergency-stop:active {
    transform: scale(0.95);
    filter: brightness(0.9);
}

.emergency-stop-image {
    width: 120px;  /* Фиксированный разумный размер */
    max-width: 100%;  /* Не больше контейнера */
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* Responsive adjustments for emergency stop button on mobile */
@media (max-width: 600px) {
    .emergency-stop-image {
        width: 150px;
    }
}

@media (max-width: 480px) {
    .emergency-stop-image {
        width: 100px;
    }
}

/* Extra controls section */
.extra-controls {
    grid-area: extra;
    padding-top: 0;
    margin-top: -8px;
    border-top: 2px solid var(--color-border-subtle);
}

.extra-controls h2 {
    margin-bottom: 12px;
}

.file-transfers {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.file-transfer-entry {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
}

.file-transfer-entry:last-child {
    border-bottom: none;
}

.file-transfer-entry a {
    color: var(--color-primary);
    text-decoration: none;
}

.file-transfer-entry a:hover {
    text-decoration: underline;
}

.file-transfer-sending {
    color: var(--color-primary);
}

.file-transfer-sent {
    color: var(--color-success);
}

.file-transfer-receiving {
    color: var(--color-warning);
}

.file-transfer-received {
    color: var(--color-success);
}

.file-transfer-error {
    color: var(--color-danger);
}

.file-transfer-download {
    background-color: var(--color-surface);
}

.file-name-display {
    font-size: 14px;
    color: var(--color-neutral-dark);
    font-style: italic;
    display: none;
}

/* Responsive adjustments for new sections */
@media (max-width: 600px) {
    .video-row {
        flex-direction: column;
    }
    
    .chat-input-row {
        flex-direction: column;
    }
    
    .extra-row {
        flex-direction: column;
    }
    
    .file-transfer-entry {
        padding: 10px;
        font-size: 13px;
    }
    
    .file-transfer-entry .btn {
        font-size: 13px;
        padding: 6px 10px;
        min-width: 80px;
    }
}

/* Video section */
.video-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.video-container {
    flex: 1;
    min-width: 250px;
    background: var(--color-video-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.video-container figcaption {
    padding: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.video-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background: var(--color-video-bg);
}

.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-fullscreen {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    font-size: 18px;
    z-index: 10;
    transition: background var(--transition-fast);
}

.btn-fullscreen:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Video stage — single combined pane for local + remote with overlay controls */
.video-stage {
    position: relative;
    background: var(--color-video-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 16 / 9;
    width: 100%;
    min-height: 360px; /* keep the sidebar within the stage on narrow layouts */
}

.video-stage .video-main {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--color-video-bg);
    z-index: 1;
}

.video-stage .video-thumb {
    position: absolute;
    bottom: 12px;
    width: 160px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-sm);
    background: var(--color-video-bg);
    z-index: 5;
}

/* Thumb sits on the opposite side of the sidebar. Default sidebar-right
   → thumb-left. Flip side toggles .controls-left on the stage. */
.video-stage.controls-right .video-thumb { left: 12px; right: auto; }
.video-stage.controls-left  .video-thumb { right: 12px; left: auto; }

.video-stage.swapped .video-main {
    inset: auto;
    bottom: 12px;
    top: auto;
    width: 160px;
    height: auto;
    aspect-ratio: 4 / 3;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-sm);
    z-index: 5;
}

.video-stage.controls-right.swapped .video-main { left: 12px; right: auto; }
.video-stage.controls-left.swapped  .video-main { right: 12px; left: auto; }

.video-stage.swapped .video-thumb {
    inset: 0;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    z-index: 1;
}

/* Unified sidebar: media controls, context call actions, fullscreen,
   side-flip arrow. Anchored to the bottom so the flip arrow sits right
   next to the thumb. Switches side via .controls-{left,right} on the
   .video-stage. */
.video-sidebar {
    position: absolute;
    bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 999px;
    z-index: 20;
    align-items: center;
    transition: opacity var(--transition-fast);
}

.video-stage.controls-right .video-sidebar { right: 12px; }
.video-stage.controls-left  .video-sidebar { left: 12px; }

.video-sidebar.controls-hidden {
    opacity: 0;
    pointer-events: none;
}

/* Call-actions group inside the sidebar — same vertical stacking. */
#video-call-actions.video-call-actions {
    position: static;
    background: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    inset: auto;
    width: auto;
}

.vc-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.vc-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.vc-btn.vc-btn--muted   { background: rgba(220, 53, 69, 0.7); }
.vc-btn.vc-btn--danger  { background: rgba(220, 53, 69, 0.85); }
.vc-btn.vc-btn--danger:hover { background: rgba(220, 53, 69, 1); }
.vc-btn.vc-btn--success { background: rgba(40, 167, 69, 0.85); }
.vc-btn.vc-btn--success:hover { background: rgba(40, 167, 69, 1); }
.vc-btn.vc-btn--info    { background: rgba(0, 123, 255, 0.7); }
.vc-btn.vc-btn--subtle  { background: rgba(255, 255, 255, 0.1); opacity: 0.7; }
.vc-btn.vc-btn--subtle:hover { opacity: 1; background: rgba(255, 255, 255, 0.25); }

/* Slot card uses the same vc-btn icon buttons as the video sidebar, but
   sits on a light (success-bg) background. The default dark-translucent
   base doesn't contrast well there, so give it a darker base. Colored
   modifiers (danger/success/info) still carry their own backgrounds. */
.slot-card .vc-btn { background: rgba(0, 0, 0, 0.12); color: var(--color-text); }
.slot-card .vc-btn:hover { background: rgba(0, 0, 0, 0.2); }
.slot-card .vc-btn.vc-btn--muted,
.slot-card .vc-btn.vc-btn--danger,
.slot-card .vc-btn.vc-btn--success,
.slot-card .vc-btn.vc-btn--info { color: white; }

.video-remote-off {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    z-index: 15;
    pointer-events: none;
}

/* These new rules set `display: flex/inline-flex` and live later in the
   cascade than `.hidden { display: none; }`. Re-assert `display: none`
   when `.hidden` is combined with any of them so the utility class wins. */
.vc-btn.hidden,
.video-remote-off.hidden,
.video-self-hold.hidden,
.video-call-actions.hidden { display: none; }

.video-self-hold {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    z-index: 16;
    pointer-events: none;
}

.video-self-hold-text {
    margin: 0;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.4;
}

.video-remote-off-text {
    margin: 0;
    padding: 16px;
    font-size: 1rem;
    text-align: center;
    line-height: 1.4;
}

/* Legacy call-actions rules removed — the group now lives inside
   #video-sidebar and inherits vertical stacking from there. */

@media (max-width: 600px) {
    /* Portrait mobile: use a taller aspect so the sidebar has room. */
    .video-stage { aspect-ratio: 3 / 4; }
    .video-stage .video-thumb {
        width: 120px;
        bottom: 8px;
    }
    .video-stage.swapped .video-main {
        width: 120px;
        bottom: 8px;
    }
    .video-sidebar {
        bottom: 8px;
    }
    .video-stage.controls-right .video-sidebar { right: 8px; }
    .video-stage.controls-left  .video-sidebar { left: 8px; }
    .video-stage.controls-right .video-thumb { left: 8px; }
    .video-stage.controls-left  .video-thumb { right: 8px; }
    .vc-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
}

/* Chat section */
.chat-messages {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.chat-message {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.chat-input-row {
    display: flex;
    gap: 8px;
}

.chat-input-row input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
}

.chat-input-row input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Controls section */
/* Settings section */
.settings-section {
    margin-top: 20px;
}

.settings-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Footer */
.app-footer {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    text-align: center;
    margin-top: 20px;
    margin-left: auto;
    margin-right: auto;
    max-width: 800px;
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-footer span {
    display: inline-block;
    margin: 0 10px;
    color: var(--color-text-muted);
    font-size: 0.9em;
}

/* File input */
.file-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.file-label:hover {
    border-color: var(--color-primary);
}

.file-label input[type="file"] {
    display: none;
}

.extra-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Landing page (main domain) */
.landing-main {
    max-width: 500px;
    margin: 50px auto;
    padding: 40px 20px 20px;
    text-align: center;
}

.landing-booth-img {
    max-width: 220px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 20px;
    user-select: none;
}

.landing-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    margin-bottom: 16px;
    display: block;
}

.landing-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.landing-error {
    color: var(--color-danger-text);
    margin-top: 12px;
    font-size: 14px;
}

@media (max-width: 600px) {
    .landing-main {
        max-width: 300px;
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* Modal styles */
.modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
}

.modal-content h2 {
    margin-top: 0;
    color: var(--color-text);
}

.modal-actions {
    margin-top: 20px;
}

.modal-actions .btn + .btn {
    margin-left: 10px;
}

.modal-content p {
    margin: 15px 0;
    color: var(--color-text-muted);
    line-height: 1.6;
}

@media (max-width: 480px) {
    .modal-content {
        margin: 5% auto;
        padding: 20px;
        width: 95%;
        max-width: none;
    }
}

/* ========== Htpasswd Generator Styles ========== */
.htpasswd-generator {
    margin-top: 20px;
    padding: 20px;
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-primary-tint-light) 0%, var(--color-primary-tint) 100%);
}

.htpasswd-generator h3 {
    margin: 0 0 15px 0;
    color: var(--color-primary);
    font-size: 18px;
}

.htpasswd-form .form-group {
    margin-bottom: 15px;
}

.htpasswd-form label {
    display: block;
    margin-bottom: 5px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.htpasswd-form input[type="text"],
.htpasswd-form input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color var(--transition-fast);
}

.htpasswd-form input[type="text"]:focus,
.htpasswd-form input[type="password"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-overlay);
}

.password-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.password-input-wrapper input {
    flex: 1;
}

.btn-toggle-password {
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    cursor: pointer;
    font-size: 18px;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.btn-toggle-password:hover {
    background-color: var(--color-primary-tint);
    border-color: var(--color-primary);
}

.htpasswd-generator .btn {
    width: 100%;
    margin-top: 10px;
}

/* ─── In-page notifications ──────────────────────────────────────────────── */

#notification-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.notification {
    margin: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    pointer-events: auto;
    animation: notification-fade 5s ease-in-out forwards;
}

.notification-error {
    background: var(--color-danger);
}

.notification-warning {
    background: var(--color-warning);
    color: #000;
}

.notification-info {
    background: var(--color-primary);
}

@keyframes notification-fade {
    0% { opacity: 0; transform: translateY(-20px); }
    10% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}
