/* ===== HEADER ===== */
.header {
    margin: 0;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 250, 250, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    gap: 16px;
}

.header-left {
    flex: 1;
    min-width: 0;
    max-width: 240px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Search */
.search-wrapper {
    position: relative;
}

.search-wrapper .fa-search {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #b0b0b0;
    font-size: 11px;
    pointer-events: none;
}

#search-input {
    width: 100%;
    padding: 6px 10px 6px 28px;
    border-radius: 6px;
    border: none;
    font-size: 12.5px;
    background: rgba(0, 0, 0, 0.04);
    color: #111827;
    transition: all 0.2s ease;
    box-sizing: border-box;
    outline: none;
}

#search-input::placeholder {
    color: #aaa;
    font-weight: 400;
}

#search-input:focus {
    background: #fff;
    box-shadow: 0 0 0 1.5px rgba(249, 115, 22, 0.3);
}

/* Buttons */
#add-site-btn,
#refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1;
}

#add-site-btn {
    background: #f97316;
    color: #fff;
}

#add-site-btn:hover {
    background: #ea580c;
}

#add-site-btn i {
    font-size: 9px;
}

#refresh-btn {
    background: rgba(0, 0, 0, 0.04);
    color: #555;
}

#refresh-btn:hover {
    background: rgba(0, 0, 0, 0.07);
    color: #f97316;
}

#refresh-btn i {
    font-size: 10px;
}

/* Meta info (timestamp + status) */
.header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 8px;
    margin-left: 2px;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
}

#last-updated {
    font-size: 10px;
    color: #aaa;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

/* WebSocket status */
.websocket-status {
    display: flex;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    color: #22c55e;
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.websocket-status .fa-circle {
    font-size: 5px;
    margin-right: 4px;
    animation: pulse-dot 2s ease-in-out infinite;
}

.websocket-status .connected .fa-circle { color: #22c55e; }
.websocket-status .disconnected { color: #ef4444; }
.websocket-status .disconnected .fa-circle {
    color: #ef4444;
    animation: none;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.refresh-progress-container {
    padding: 4px 24px 6px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .header-bar { padding: 8px 16px; gap: 8px; }
    .header-left { max-width: 180px; }
    #add-site-btn span,
    #refresh-btn span { display: none; }
    #add-site-btn,
    #refresh-btn { padding: 7px 9px; }
}

@media (max-width: 600px) {
    .header-bar { flex-wrap: wrap; }
    .header-left { max-width: 100%; flex: 1 1 100%; order: 2; }
    .header-right { order: 1; width: 100%; justify-content: flex-end; }
    .header-meta { display: none; }
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: modalFadeIn 0.15s ease-out;
}

@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal .modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 28px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    position: relative;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal .modal-content h2 {
    margin: 0 0 20px 0;
    font-size: 17px;
    font-weight: 600;
    color: #111827;
}

.modal .close-button {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal .close-button:hover { color: #111827; background: #f3f4f6; }

.add-site-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.add-site-form input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    background: #fafafa;
    color: #111827;
    transition: border-color 0.15s;
    box-sizing: border-box;
    outline: none;
}

.add-site-form input[type="text"]::placeholder { color: #9ca3af; }
.add-site-form input[type="text"]:focus { border-color: #f97316; background: #fff; }

.form-options {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #4b5563;
}

.form-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.form-options select {
    padding: 5px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    color: #111827;
    cursor: pointer;
    outline: none;
}

.form-options select:focus { border-color: #f97316; }

.add-site-form .action-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background: #f97316;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.add-site-form .action-button:hover { background: #ea580c; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .header-controls { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
    .search-wrapper { max-width: 100%; flex: 1 1 100%; order: 3; }
    .refresh-container { margin-left: 0; }
}

@media (max-width: 600px) {
    .header-controls { flex-direction: column; align-items: stretch; }
    .refresh-container { justify-content: space-between; }
    #add-site-btn, #refresh-btn { width: 100%; justify-content: center; }
}
