/* =========================================
   Theme polish — sleek dark refinement
   ========================================= */

/* ---- Refined typography ---- */
body {
    letter-spacing: -0.005em;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 650;
}

h1.display-4 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

h2.h3 {
    font-weight: 650;
    letter-spacing: -0.02em;
}

p.lead {
    font-weight: 400;
    letter-spacing: 0;
}

/* ---- Hero refinement ---- */
.hero-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-hover) 100%);
    border: 1px solid var(--border);
    padding: 3rem 1.5rem 2.5rem;
    margin-bottom: 2rem;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.hero-section h1 {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-section p.lead {
    position: relative;
    color: var(--text-muted);
}

.hero-section .btn {
    position: relative;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.hero-section .btn-primary {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hero-section .btn-primary:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.3), 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* ---- Navbar polish ---- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1040;
    background: rgba(2, 4, 10, 0.85) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(36, 48, 63, 0.5);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.navbar-brand {
    position: relative;
}

.navbar-brand::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
    border-radius: 1px;
}

.navbar-brand:hover::after {
    width: 100%;
}

.navbar-nav .nav-link {
    position: relative;
    padding: 0.5rem 0.875rem !important;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.25s ease;
    border-radius: 1px;
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    width: 60%;
}

/* ---- Card polish ---- */
.card {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(99, 102, 241, 0.05);
    transform: translateY(-2px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
    color: var(--text-muted);
    padding: 0.875rem 1rem;
}

/* ---- Server card refinements ---- */
.server-card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.server-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(99, 102, 241, 0.08);
}

.server-card:hover .server-banner {
    transform: scale(1.02);
}

.server-banner {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0;
}

.server-card .card-title a {
    transition: color 0.15s ease;
}

.server-card .card-title a:hover {
    color: var(--accent) !important;
}

/* ---- Button polish ---- */
.btn {
    position: relative;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
    padding: 0.5rem 1.125rem;
    border-radius: var(--radius);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transition: left 0.4s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #02040a;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #02040a;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.2);
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--border-hover);
    color: var(--text-strong);
}

.btn-outline-primary:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.btn-light {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-muted);
}

.btn-light:hover {
    background: var(--surface-hover);
    color: var(--text-strong);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 0.375rem;
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius);
}

/* ---- Form polish ---- */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
    background: var(--bg-body);
    border: 1px solid var(--border);
    color: var(--text);
    caret-color: var(--text);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.form-control:hover,
.form-select:hover,
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
input[type="url"]:hover,
input[type="tel"]:hover,
textarea:hover,
select:hover {
    border-color: var(--border-hover);
}

.form-control:focus,
.form-select:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft), 0 0 12px rgba(99, 102, 241, 0.08);
    background: var(--surface);
    color: var(--text);
    caret-color: var(--text);
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-dim);
    opacity: 1;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0px 1000px var(--surface) inset;
    box-shadow: 0 0 0px 1000px var(--surface) inset;
    caret-color: var(--text);
    transition: background-color 5000s ease-in-out 0s;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-group-text {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ---- Badge polish ---- */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.3em 0.6em;
    border-radius: 0.375rem;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.bg-success { background-color: rgba(52, 211, 153, 0.15) !important; color: var(--success) !important; border-color: rgba(52, 211, 153, 0.25) !important; }
.bg-danger { background-color: rgba(248, 113, 113, 0.15) !important; color: var(--danger) !important; border-color: rgba(248, 113, 113, 0.25) !important; }
.bg-warning { background-color: rgba(251, 191, 36, 0.15) !important; color: var(--warning) !important; border-color: rgba(251, 191, 36, 0.25) !important; }
.bg-info { background-color: rgba(99, 102, 241, 0.15) !important; color: var(--accent) !important; border-color: rgba(99, 102, 241, 0.25) !important; }
.bg-secondary { background-color: var(--surface-hover) !important; color: var(--text-muted) !important; }
.bg-light { background-color: var(--surface-hover) !important; color: var(--text) !important; }
.bg-dark { background-color: var(--bg) !important; color: var(--text) !important; }

/* Override Bootstrap light utilities for dark theme */
.text-dark { color: var(--text-strong) !important; }
.text-secondary { color: var(--text-muted) !important; }
.border-secondary { border-color: var(--border) !important; }
.table-light { background-color: var(--surface-hover) !important; color: var(--text) !important; }
.table-active { background-color: var(--accent-soft) !important; color: var(--text-strong) !important; }
.bg-white { background-color: var(--surface) !important; color: var(--text) !important; }

/* ---- Table polish ---- */
.table {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface);
}

.table thead th {
    background: var(--surface-hover);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1rem;
}

.table tbody td {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    padding: 0.875rem 1rem;
    vertical-align: middle;
    transition: background 0.15s ease;
}

.table tbody tr:hover td {
    background: var(--surface-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- List group polish ---- */
.list-group-item {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    transition: background 0.15s ease;
}

.list-group-item:hover {
    background: var(--surface-hover);
}

.list-group-flush > .list-group-item {
    border-left: 0;
    border-right: 0;
    border-top: 0;
}

/* ---- Progress bar polish ---- */
.progress {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Pagination polish ---- */
.pagination .page-link {
    border-radius: var(--radius);
    margin: 0 0.125rem;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    background: var(--surface);
}

.pagination .page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
    color: #02040a;
}

.pagination .page-link:hover {
    background-color: var(--surface-hover);
    border-color: var(--border-hover);
    color: var(--text-strong);
    transform: translateY(-1px);
}

/* ---- Dropdown polish ---- */
.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border-radius: var(--radius);
    margin-top: 0.375rem;
    padding: 0.5rem 0;
    overflow: hidden;
}

.dropdown-item {
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.12s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: var(--text-strong);
    background: var(--surface-hover);
}

/* ---- Alert polish ---- */
.alert {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-weight: 500;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
}

/* ---- Modal polish ---- */
.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-lg);
    color: var(--text);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.modal-title {
    color: var(--text-strong);
    font-weight: 650;
    letter-spacing: -0.01em;
}

.btn-close {
    filter: invert(0.6);
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.btn-close:hover {
    opacity: 1;
}

/* ---- Footer polish ---- */
footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    padding: 3rem 1rem 2rem;
    margin-top: auto;
}

footer h5,
footer h6 {
    color: var(--text-strong);
    margin-bottom: 1rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

footer a {
    color: var(--text-muted);
    transition: color 0.15s ease;
}

footer a:hover {
    color: var(--text-strong);
}

footer .list-unstyled li {
    margin-bottom: 0.625rem;
}

footer hr {
    border-color: var(--border);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ---- Selection ---- */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: var(--text-strong);
}

/* ---- Focus visible ---- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Code / pre ---- */
code {
    background: var(--border);
    color: var(--accent);
    padding: 0.15em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.85em;
}

pre {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text);
}

/* ---- Responsive tweaks ---- */
@media (max-width: 768px) {
    .hero-section h1 { font-size: 1.75rem; }
    .hero-section { padding: 3rem 1rem; }
    .card-body { padding: 0.875rem; }
    .table thead th,
    .table tbody td { padding: 0.625rem 0.75rem; }
}

@media (max-width: 576px) {
    .hero-section h1 { font-size: 1.5rem; }
    .navbar-brand { font-size: 1rem; }
    .card-body { padding: 0.75rem; }
    .btn { padding: 0.5rem 0.875rem; font-size: 0.85rem; }
}

/* ---- Print ---- */
@media print {
    .navbar, footer, .btn, .dropdown { display: none !important; }
    .card { box-shadow: none !important; border: 1px solid #334155 !important; }
    body { background: #fff !important; color: #000 !important; }
}
