/* ===================================
   MDPilot Custom Styles
   Bootstrap 5.3 + Bootstrap Icons
   =================================== */

/* ---------- CSS Variables ---------- */
:root {
    --sidebar-width: 250px;
    --navbar-height: 56px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #3b82f6;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --body-bg: #f1f5f9;
}

/* ---------- Global ---------- */
body {
    font-size: 14px;
    background-color: var(--body-bg);
    overflow-x: hidden;
}

/* ---------- Navbar ---------- */
.navbar {
    z-index: 1030;
    height: var(--navbar-height);
}
.navbar-brand {
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

/* ---------- Layout Wrapper ---------- */
.wrapper {
    display: flex;
    min-height: calc(100vh - var(--navbar-height) - 56px);
    padding-top: var(--navbar-height);
}

/* ---------- Sidebar ---------- */
.sidebar-wrapper {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    min-height: calc(100vh - var(--navbar-height));
    padding-top: 1rem;
    position: fixed;
    top: var(--navbar-height);
    bottom: 0;
    left: 0;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1020;
}

.sidebar-heading {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: #64748b !important;
}

.sidebar-link {
    color: var(--sidebar-text) !important;
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}
.sidebar-link:hover {
    color: var(--sidebar-text-active) !important;
    background: var(--sidebar-hover);
}
.sidebar-link.active {
    color: var(--sidebar-text-active) !important;
    background: var(--sidebar-active);
    font-weight: 600;
}
.sidebar-link i {
    width: 20px;
    text-align: center;
}

/* ---------- Main Content ---------- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 1.5rem 2rem;
    min-height: calc(100vh - var(--navbar-height) - 56px);
}

/* ---------- Footer ---------- */
.app-footer {
    margin-left: var(--sidebar-width);
}

/* ---------- Stat Cards ---------- */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 0.5rem;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.08) !important;
}
.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

/* ---------- Cards (general) ---------- */
.card {
    border-radius: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
}
.card-header {
    border-radius: 0.5rem 0.5rem 0 0 !important;
}

/* ---------- Tables ---------- */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
}
.table td, .table th {
    vertical-align: middle;
    font-size: 0.875rem;
}
.table thead th {
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}
.table-hover tbody tr:hover {
    background-color: #f1f5f9;
}

/* ---------- Buttons ---------- */
.btn {
    font-size: 0.875rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.btn-primary {
    background-color: #3b82f6;
    border-color: #3b82f6;
}
.btn-primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* ---------- Forms ---------- */
.form-control, .form-select {
    font-size: 0.875rem;
    border-radius: 0.375rem;
    border-color: #d1d5db;
}
.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}
.form-label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: #374151;
    margin-bottom: 0.35rem;
}

/* ---------- Badges ---------- */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    font-size: 0.8125rem;
    background: transparent;
    padding: 0;
}

/* ---------- Page header ---------- */
h2 {
    font-size: 1.5rem;
    color: #1e293b;
}

/* ---------- Scrollbar (sidebar) ---------- */
.sidebar-wrapper::-webkit-scrollbar {
    width: 4px;
}
.sidebar-wrapper::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

/* ---------- Crawl Management ---------- */
.crawl-btn {
    min-width: 100px;
}
.crawl-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}
#crawlResults .table td {
    font-size: 0.8125rem;
}
#crawlResults .text-truncate {
    max-width: 200px;
    display: inline-block;
    vertical-align: bottom;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .sidebar-wrapper {
        transform: translateX(-100%);
    }
    .sidebar-wrapper.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    .app-footer {
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .stat-card .h3 {
        font-size: 1.25rem;
    }
    .main-content {
        padding: 0.75rem;
    }
}
