/* Custom styles for Crawler Admin Dashboard */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
}

/* University cards drag-and-drop styles */
.university-card {
    transition: box-shadow 0.2s, transform 0.1s;
    border-left: 4px solid #dee2e6;
}

.university-card:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
}

.university-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.drag-handle {
    cursor: grab;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Global styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
}

/* Loading spinner overlay */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Metrics display */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.metric-row:last-child {
    border-bottom: none;
}

/* Table improvements */
.table {
    background-color: white;
}

.table-hover tbody tr:hover {
    background-color: #f5f5f5;
}

th.sortable {
    user-select: none;
}

th.sortable:hover {
    background-color: #e9ecef;
}

/* Card improvements */
.card {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.card-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
}

/* Badge styles */
.badge {
    font-weight: 500;
    padding: 0.4em 0.6em;
}

/* Navbar customization */
.navbar-dark .navbar-nav .nav-link.active {
    color: #fff !important;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
}

/* Filter sidebar */
.offcanvas {
    width: 350px !important;
}

.offcanvas-body {
    padding: 1.5rem;
}

/* Form improvements */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Button improvements */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Login page */
.card.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Pagination */
.pagination {
    margin-top: 1rem;
}

.page-link {
    color: var(--primary-color);
}

.page-link:hover {
    color: #0a58ca;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Alert improvements */
.alert {
    border: none;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: var(--success-color);
}

.alert-danger {
    border-left-color: var(--danger-color);
}

.alert-warning {
    border-left-color: var(--warning-color);
}

.alert-info {
    border-left-color: var(--info-color);
}

/* Toast improvements */
.toast {
    min-width: 300px;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .offcanvas {
        width: 100% !important;
    }

    .table {
        font-size: 0.875rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}

/* Utility classes */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Chart container */
canvas {
    max-width: 100%;
}

/* Link styling */
a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Status badges */
.badge.bg-success {
    background-color: var(--success-color) !important;
}

.badge.bg-danger {
    background-color: var(--danger-color) !important;
}

.badge.bg-warning {
    background-color: var(--warning-color) !important;
    color: #000;
}

.badge.bg-info {
    background-color: var(--info-color) !important;
    color: #000;
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
}

.badge.bg-secondary {
    background-color: var(--secondary-color) !important;
}

/* ============================================
   SIDEBAR LAYOUT
   ============================================ */

/* Sidebar container */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1050;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

/* Sidebar header */
.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-brand i {
    font-size: 1.5rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
}

/* Sidebar navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-decoration: none;
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.sidebar-link i {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
}

.sidebar-section {
    padding: 1rem 1.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.5rem;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.user-info i {
    font-size: 2rem;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-email {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: capitalize;
}

/* Main wrapper */
.main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-wrapper.no-sidebar {
    margin-left: 0;
}

.content-area {
    padding: 2rem;
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1000;
    background: var(--primary-color);
    border: none;
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    font-size: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ============================================
   RESPONSIVE SIDEBAR (Mobile)
   ============================================ */

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .main-wrapper,
    .main-wrapper.no-sidebar {
        margin-left: 0;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .mobile-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .content-area {
        padding: 5rem 1rem 1rem;
    }
}

/* ============================================
   HEALTH INDICATORS (Crawler Metrics)
   ============================================ */

.health-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.health-indicator.healthy {
    background: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.health-indicator.warning {
    background: rgba(255, 193, 7, 0.1);
    color: var(--warning-color);
}

.health-indicator.critical {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.health-indicator i {
    font-size: 1.25rem;
}

.status-badge {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: currentColor;
    color: #fff;
    opacity: 0.8;
}

/* ============================================
   DOMAIN LISTS (Data Analytics)
   ============================================ */

.domain-list {
    max-height: 500px;
    overflow-y: auto;
}

.domain-item,
.active-domain-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.domain-item:last-child,
.active-domain-item:last-child {
    border-bottom: none;
}

.domain-rank {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 35px;
}

.domain-name {
    flex: 1;
    font-family: monospace;
    font-size: 0.875rem;
}

.domain-count,
.activity-count {
    font-weight: 500;
    color: #666;
}

.active-domains-list {
    margin-bottom: 0.5rem;
}

/* ============================================
   EVENT NAME WRAPPING
   ============================================ */

.event-name-wrap {
    display: block;
    max-width: 300px;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    line-height: 1.4;
}
