/* OS Installer Pro — Frontend Styles */
:root {
    --osip-bg:          #0d1117;
    --osip-surface:     #161b22;
    --osip-surface2:    #21262d;
    --osip-border:      #30363d;
    --osip-text:        #e6edf3;
    --osip-muted:       #8b949e;
    --osip-accent:      #58a6ff;
    --osip-accent-glow: rgba(88,166,255,0.15);
    --osip-success:     #3fb950;
    --osip-warning:     #d29922;
    --osip-danger:      #f85149;
    --osip-radius:      10px;
    --osip-radius-lg:   16px;
}

.osip-wrapper {
    background:    var(--osip-bg);
    border:        1px solid var(--osip-border);
    border-radius: var(--osip-radius-lg);
    padding:       0;
    font-family:   -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color:         var(--osip-text);
    max-width:     900px;
    margin:        0 auto;
    overflow:      hidden;
}

/* Header */
.osip-header {
    background:  linear-gradient(135deg, #1c2333 0%, #0d1117 100%);
    border-bottom: 1px solid var(--osip-border);
    padding:     28px 32px;
    display:     flex;
    align-items: center;
    gap:         18px;
}
.osip-header-icon {
    font-size:        36px;
    width:            56px;
    height:           56px;
    background:       var(--osip-surface2);
    border:           1px solid var(--osip-border);
    border-radius:    12px;
    display:          flex;
    align-items:      center;
    justify-content:  center;
    flex-shrink:      0;
}
.osip-title {
    margin:      0 0 4px;
    font-size:   22px;
    font-weight: 700;
    color:       var(--osip-text);
    line-height: 1;
}
.osip-subtitle {
    margin:    0;
    font-size: 13px;
    color:     var(--osip-muted);
}

/* Sections */
.osip-section {
    padding: 28px 32px;
    border-bottom: 1px solid var(--osip-border);
}
.osip-section:last-child { border-bottom: none; }
.osip-section-install { background: rgba(88,166,255,0.03); }

.osip-step-label {
    display:     flex;
    align-items: center;
    gap:         10px;
    font-size:   13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color:       var(--osip-muted);
    margin-bottom: 18px;
}
.osip-step-num {
    background:    var(--osip-accent);
    color:         #fff;
    width:         22px;
    height:        22px;
    border-radius: 50%;
    display:       flex;
    align-items:   center;
    justify-content: center;
    font-size:     12px;
    font-weight:   700;
    flex-shrink:   0;
}

/* OS Grid */
.osip-os-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap:                   12px;
}
.osip-empty { color: var(--osip-muted); font-size: 14px; }

.osip-os-card {
    background:    var(--osip-surface);
    border:        2px solid var(--osip-border);
    border-radius: var(--osip-radius);
    padding:       16px 12px;
    text-align:    center;
    cursor:        pointer;
    position:      relative;
    transition:    border-color .15s, background .15s, transform .1s;
}
.osip-os-card:hover {
    border-color: var(--osip-accent);
    background:   var(--osip-accent-glow);
    transform:    translateY(-2px);
}
.osip-os-card.selected {
    border-color: var(--osip-accent);
    background:   var(--osip-accent-glow);
    box-shadow:   0 0 0 3px rgba(88,166,255,0.2);
}
.osip-os-icon img,
.osip-os-icon .osip-default-icon {
    width:  48px;
    height: 48px;
    object-fit: contain;
    display: block;
    margin:  0 auto 10px;
    font-size: 42px;
    line-height: 1;
}
.osip-os-name {
    font-size:   13px;
    font-weight: 600;
    color:       var(--osip-text);
    line-height: 1.3;
}
.osip-os-desc {
    font-size:  11px;
    color:      var(--osip-muted);
    margin-top: 4px;
    line-height: 1.3;
}
.osip-os-check {
    position:      absolute;
    top:           8px;
    right:         8px;
    background:    var(--osip-accent);
    color:         #fff;
    width:         18px;
    height:        18px;
    border-radius: 50%;
    font-size:     11px;
    display:       none;
    align-items:   center;
    justify-content: center;
    font-weight:   700;
}
.osip-os-card.selected .osip-os-check { display: flex; }

/* Fields */
.osip-fields { display: flex; flex-direction: column; gap: 14px; }
.osip-field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.osip-field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
.osip-field-wide  { flex: 3; }
.osip-field-narrow { flex: 1; min-width: 90px; }
.osip-field label {
    font-size:   12px;
    font-weight: 600;
    color:       var(--osip-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.osip-field input,
.osip-wrapper input[type="text"],
.osip-wrapper input[type="password"],
.osip-wrapper input[type="number"] {
    background:    var(--osip-surface);
    border:        1px solid var(--osip-border);
    border-radius: 8px;
    color:         var(--osip-text);
    padding:       10px 14px;
    font-size:     14px;
    font-family:   inherit;
    outline:       none;
    transition:    border-color .15s, box-shadow .15s;
    width:         100%;
    box-sizing:    border-box;
}
.osip-field input:focus,
.osip-wrapper input:focus {
    border-color: var(--osip-accent);
    box-shadow:   0 0 0 3px rgba(88,166,255,0.15);
}
.osip-field input::placeholder { color: var(--osip-muted); }

/* Test row */
.osip-test-row {
    display:     flex;
    align-items: center;
    gap:         16px;
    margin-top:  18px;
    flex-wrap:   wrap;
}
.osip-test-result {
    font-size:   14px;
    flex:        1;
    padding:     8px 14px;
    border-radius: 8px;
    display:     none;
}
.osip-test-result:not(:empty) { display: block; }
.osip-result-success { background: rgba(63,185,80,.12); color: var(--osip-success); border: 1px solid rgba(63,185,80,.3); }
.osip-result-error   { background: rgba(248,81,73,.12);  color: var(--osip-danger);  border: 1px solid rgba(248,81,73,.3); }

/* Buttons */
.osip-btn {
    display:       inline-flex;
    align-items:   center;
    gap:           8px;
    padding:       11px 22px;
    border-radius: 8px;
    border:        none;
    font-size:     14px;
    font-weight:   600;
    cursor:        pointer;
    transition:    background .15s, transform .1s, box-shadow .15s;
    font-family:   inherit;
    white-space:   nowrap;
}
.osip-btn-icon { font-size: 16px; }

.osip-btn-test {
    background: var(--osip-surface2);
    color:      var(--osip-text);
    border:     1px solid var(--osip-border);
}
.osip-btn-test:hover {
    background:   var(--osip-surface);
    border-color: var(--osip-accent);
    color:        var(--osip-accent);
}

.osip-btn-install {
    background:    #1f6feb;
    color:         #fff;
    padding:       14px 32px;
    font-size:     16px;
    opacity:       0.4;
    cursor:        not-allowed;
    transition:    all .2s;
}
.osip-btn-install.osip-btn-ready {
    opacity:    1;
    cursor:     pointer;
    box-shadow: 0 4px 20px rgba(31,111,235,0.4);
}
.osip-btn-install.osip-btn-ready:hover {
    background:  #388bfd;
    transform:   translateY(-1px);
    box-shadow:  0 6px 24px rgba(31,111,235,0.5);
}
.osip-btn-install:disabled { pointer-events: none; }
.osip-btn-install.osip-btn-ready { pointer-events: auto; }

/* Warning box */
.osip-warning {
    display:       flex;
    gap:           14px;
    background:    rgba(210,153,34,0.1);
    border:        1px solid rgba(210,153,34,0.35);
    border-radius: 8px;
    padding:       14px 18px;
    font-size:     13px;
    color:         #e3b341;
    margin-bottom: 20px;
    line-height:   1.5;
}
.osip-warning-icon { font-size: 20px; flex-shrink: 0; }

/* Spinner */
.osip-spinner {
    display:      inline-block;
    width:        14px;
    height:       14px;
    border:       2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation:    osip-spin .6s linear infinite;
    vertical-align: middle;
}
@keyframes osip-spin { to { transform: rotate(360deg); } }

/* Modal */
.osip-modal-overlay {
    display:         none;
    position:        fixed;
    inset:           0;
    background:      rgba(0,0,0,.75);
    z-index:         99999;
    align-items:     center;
    justify-content: center;
    padding:         20px;
    backdrop-filter: blur(4px);
}
.osip-modal-overlay.active { display: flex; }

.osip-modal {
    background:    var(--osip-bg);
    border:        1px solid var(--osip-border);
    border-radius: var(--osip-radius-lg);
    width:         100%;
    max-width:     860px;
    height:        580px;
    display:       flex;
    flex-direction: column;
    overflow:      hidden;
    box-shadow:    0 24px 80px rgba(0,0,0,.6);
    animation:     osip-modal-in .2s ease;
}
@keyframes osip-modal-in { from { opacity:0; transform: scale(.96); } to { opacity:1; transform: scale(1); } }

.osip-modal-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         14px 18px;
    background:      var(--osip-surface);
    border-bottom:   1px solid var(--osip-border);
    flex-shrink:     0;
}
.osip-modal-title {
    display:     flex;
    align-items: center;
    gap:         6px;
    font-size:   13px;
    font-weight: 600;
    color:       var(--osip-muted);
}
.osip-terminal-dot {
    width: 13px; height: 13px; border-radius: 50%;
}
.osip-terminal-dot.red    { background: #ff5f57; }
.osip-terminal-dot.yellow { background: #febc2e; }
.osip-terminal-dot.green  { background: #28c840; }

.osip-modal-close {
    background:    none;
    border:        1px solid var(--osip-border);
    color:         var(--osip-muted);
    width:         28px;
    height:        28px;
    border-radius: 6px;
    cursor:        pointer;
    font-size:     14px;
    display:       none;
    align-items:   center;
    justify-content: center;
    transition:    background .15s, color .15s;
}
.osip-modal-close:hover { background: var(--osip-danger); color: #fff; border-color: var(--osip-danger); }

.osip-modal-body {
    flex:       1;
    overflow:   hidden;
    padding:    8px;
    background: var(--osip-bg);
}
#osip-terminal {
    width:  100%;
    height: 100%;
}
.osip-modal-footer {
    padding:      10px 18px;
    background:   var(--osip-surface);
    border-top:   1px solid var(--osip-border);
    font-size:    12px;
    color:        var(--osip-muted);
    font-family:  monospace;
    white-space:  nowrap;
    overflow:     hidden;
    text-overflow: ellipsis;
    flex-shrink:  0;
}

/* VNC Bar */
.osip-vnc-bar {
    display:       flex;
    align-items:   center;
    gap:           10px;
    padding:       10px 18px;
    background:    linear-gradient(90deg, rgba(56,212,253,0.1), rgba(88,166,255,0.08));
    border-bottom: 1px solid rgba(56,212,253,0.3);
    flex-shrink:   0;
    flex-wrap:     wrap;
    animation:     osip-vnc-pulse 2s ease-in-out infinite;
}
@keyframes osip-vnc-pulse {
    0%,100% { background: linear-gradient(90deg,rgba(56,212,253,.08),rgba(88,166,255,.06)); }
    50%     { background: linear-gradient(90deg,rgba(56,212,253,.18),rgba(88,166,255,.14)); }
}
.osip-vnc-icon  { font-size: 20px; flex-shrink: 0; }
.osip-vnc-label { font-size: 13px; font-weight: 600; color: #39c5cf; white-space: nowrap; }
.osip-vnc-link  {
    font-size: 12px; color: #58a6ff; flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: monospace;
}
.osip-btn-vnc {
    background:    linear-gradient(135deg, #1f6feb, #39c5cf);
    color:         #fff;
    border:        none;
    border-radius: 6px;
    padding:       8px 16px;
    font-size:     13px;
    font-weight:   700;
    cursor:        pointer;
    white-space:   nowrap;
    flex-shrink:   0;
    transition:    transform .1s, box-shadow .15s;
    box-shadow:    0 2px 12px rgba(31,111,235,0.4);
    font-family:   inherit;
}
.osip-btn-vnc:hover { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(31,111,235,.6); }

/* Responsive */
@media (max-width: 600px) {
    .osip-header, .osip-section { padding: 20px 18px; }
    .osip-os-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .osip-field-row { flex-direction: column; }
    .osip-modal { height: 90vh; }
}
