/* JSIP modern dashboard UI */
:root {
    --bg: #08111f;
    --bg-soft: #0f1b2e;
    --card: rgba(255, 255, 255, 0.92);
    --card-solid: #ffffff;
    --text: #142033;
    --muted: #64748b;
    --line: rgba(148, 163, 184, 0.24);
    --primary: #4f46e5;
    --primary-2: #06b6d4;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 22px 60px rgba(2, 8, 23, 0.18);
    --radius: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 0%, rgba(79, 70, 229, 0.38), transparent 28rem),
        radial-gradient(circle at 90% 6%, rgba(6, 182, 212, 0.34), transparent 26rem),
        linear-gradient(180deg, #09111f 0%, #101827 38%, #eef3fb 72%, #f8fafc 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom, #000 0, transparent 62%);
}

a { color: inherit; }

.container {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
    position: relative;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
    padding: 22px;
    color: #fff;
    background: linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 24px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.18);
    backdrop-filter: blur(18px);
}

header h1 {
    margin: 0;
    color: #fff;
    letter-spacing: -0.04em;
    font-size: clamp(26px, 4vw, 42px);
    line-height: 1.12;
}

header h1::before {
    content: "⛏️";
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-right: 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.35);
    font-size: 24px;
    vertical-align: middle;
}

header > div {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

h1, h2, h3 {
    color: #111827;
    letter-spacing: -0.025em;
}

h2 {
    margin: 0 0 16px;
    font-size: 22px;
}

h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #334155;
}

/* Login / public pages */
.login-container {
    width: min(440px, calc(100% - 32px));
    margin: 9vh auto;
    padding: 34px;
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.72);
    border-radius: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-container h1 {
    margin: 0 0 24px;
    text-align: center;
    font-size: 28px;
}

.login-container h1::before {
    content: "🧭";
    display: block;
    width: 64px;
    height: 64px;
    line-height: 64px;
    margin: 0 auto 14px;
    border-radius: 20px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 18px 38px rgba(79,70,229,.28);
}

/* Layout sections */
.dashboard {
    display: grid;
    gap: 22px;
}

.section,
.server-status {
    position: relative;
    overflow: hidden;
    margin-bottom: 22px;
    padding: 22px;
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.78);
    border-radius: var(--radius);
    box-shadow: 0 16px 45px rgba(15, 23, 42, 0.10);
    backdrop-filter: blur(14px);
}

.section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--success));
}

.server-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    align-items: center;
    gap: 14px;
}

.server-status strong {
    color: var(--primary);
}

/* Forms */
.form-row {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 220px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    outline: none;
    color: #111827;
    background: rgba(255,255,255,.9);
    font: inherit;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(79,70,229,.72);
    box-shadow: 0 0 0 4px rgba(79,70,229,.12);
}

.add-form {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.add-form input[type="text"] {
    border-radius: 12px;
}

.add-form button {
    white-space: nowrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    box-shadow: 0 12px 24px rgba(37, 99, 235, .22);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 16px 30px rgba(37, 99, 235, .28);
}

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

.btn-sm {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 10px;
    font-size: 13px;
}

.btn-danger { background: linear-gradient(135deg, var(--danger), #dc2626); box-shadow: 0 12px 24px rgba(239, 68, 68, .22); }
.btn-warning { background: linear-gradient(135deg, var(--warning), #ea580c); box-shadow: 0 12px 24px rgba(245, 158, 11, .22); }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); box-shadow: 0 12px 24px rgba(16, 185, 129, .22); }
.logout-btn { background: linear-gradient(135deg, #64748b, #334155); box-shadow: 0 12px 24px rgba(51, 65, 85, .20); }

/* Tables */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 14px 0 0;
    overflow: hidden;
    background: var(--card-solid);
    border: 1px solid #e8eef7;
    border-radius: 16px;
}

table th, table td {
    padding: 13px 14px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

table th {
    color: #475569;
    background: #f8fafc;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

table tbody tr:last-child td { border-bottom: 0; }
table tbody tr:hover { background: #f8fbff; }

table td form { margin: 0 6px 6px 0; }

/* Log / charts */
.log-query-form { margin-bottom: 18px; }

.chart-container {
    position: relative;
    height: 320px;
    margin-bottom: 18px;
    padding: 10px;
    border: 1px solid #edf2f7;
    border-radius: 16px;
    background: #fff;
}

.log-list {
    max-height: 560px;
    overflow-y: auto;
    border: 1px solid #e5edf7;
    border-radius: 16px;
    background: #fff;
}

.log-entry {
    padding: 13px 16px;
    border-bottom: 1px solid #edf2f7;
}

.log-entry:last-child { border-bottom: none; }
.log-entry:hover { background-color: #f8fbff; }

.log-time {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 4px;
}

.log-message {
    color: #1f2937;
    word-break: break-word;
}

/* Statistic cards used by logs.php */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 96px;
    padding: 16px;
    background: linear-gradient(180deg, #fff, #f8fbff);
    border: 1px solid #e7eef8;
    border-radius: 16px;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -30px;
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background: rgba(79,70,229,.10);
}

.stat-title {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 7px;
}

.stat-value {
    color: #0f172a;
    font-size: 25px;
    font-weight: 850;
    letter-spacing: -0.03em;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

/* Alerts */
.alert, .error {
    padding: 12px 15px;
    border-radius: 14px;
    margin-bottom: 18px;
    font-weight: 650;
    border: 1px solid transparent;
}

.alert-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.alert-success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.alert-danger, .error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.toggle-container {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Mobile */
@media (max-width: 760px) {
    .container { width: min(100% - 20px, 1280px); padding-top: 14px; }
    header { align-items: flex-start; flex-direction: column; padding: 18px; border-radius: 20px; }
    header > div { justify-content: flex-start; width: 100%; }
    header h1::before { width: 38px; height: 38px; font-size: 20px; border-radius: 12px; }
    .section, .server-status { padding: 17px; border-radius: 16px; }
    .login-container { margin: 6vh auto; padding: 24px; }
    .add-form { flex-direction: column; }
    table th, table td { padding: 11px 10px; white-space: nowrap; }
    .chart-container { height: 270px; }
    .btn { width: auto; }
}
