/* Custom Styles for Radar Monitoring Dashboard */

body {
    background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
    background-attachment: fixed;
    color: #e2e8f0;
    font-family: 'Vazirmatn', sans-serif;
}

html {
    overflow-x: hidden;
    /* Allow natural vertical scrolling - no height restrictions */
}

body {
    overflow-x: hidden;
    /* Allow natural vertical scrolling - no height restrictions */
    /* Ensure only one scrollbar - body should be the only scrolling container */
    overflow-y: auto;
    /* Prevent any nested scrolling */
    position: relative;
}

.glass-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Datacenter Card */
.datacenter-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.5));
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 8px;
    padding: 5px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    /* No overflow restrictions - let content flow naturally */
}

@media (min-width: 768px) {
    .datacenter-card {
        border-radius: 10px;
        padding: 7px;
    }
}

.datacenter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(241, 99, 52, 0.6), transparent);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 8px 8px 0 0;
    pointer-events: none;
    z-index: 1;
}

.datacenter-card:hover::before {
    opacity: 1;
}

.datacenter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.agent-card-collapsed .agent-services {
    display: none;
}

.agent-card-collapsed .agent-toggle-btn svg {
    transform: rotate(-90deg);
}

/* Service Row */
.service-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 5px;
    align-items: center;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(51, 65, 85, 0.2);
    transition: all 0.2s;
}

@media (min-width: 768px) {
    .service-row {
        grid-template-columns: 140px 1fr;
        gap: 6px;
        padding: 2px 6px;
    }
}

.service-row:hover {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(51, 65, 85, 0.4);
}

.service-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
    width: 100%;
    min-width: 0; /* Allow truncate to work */
}

.service-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.55rem;
    border: 1.5px solid;
    transition: all 0.3s;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .service-icon {
        width: 22px;
        height: 22px;
        border-radius: 5px;
        font-size: 0.6rem;
    }
}

.service-row:hover .service-icon {
    transform: scale(1.1);
}

/* Datacenter icon in internal pages (target_detail, agent_detail) */
.datacenter-header > div > div:first-child {
    padding: 5px 10px;
}

/* Timeline */
.timeline-container {
    display: flex;
    gap: 1px;
    height: 14px;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.8);
    position: relative;
}

@media (min-width: 768px) {
    .timeline-container {
        height: 16px;
    }
}

.time-bar {
    flex: 1;
    position: relative;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 1px;
}

.time-bar:hover {
    transform: scaleY(1.4);
    z-index: 10;
    filter: brightness(1.3);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.bar-down:hover {
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.9), 0 0 16px rgba(239, 68, 68, 0.5);
    filter: brightness(1.2);
}

/* Performance colors */
.bar-excellent { background: #10b981; }
.bar-good { background: #06b6d4; }
.bar-fair { background: #3b82f6; }
.bar-slow { background: #f59e0b; }
.bar-very-slow { background: #f97316; }
.bar-down { 
    background: #dc2626;
    position: relative;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.6), inset 0 0 2px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 0, 0, 0.2);
}
.bar-down::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    pointer-events: none;
}
.bar-empty { background: #1e293b; opacity: 0.3; }

/* Tooltip */
.custom-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.7rem;
    min-width: 140px;
    max-width: 200px;
    z-index: 99999;
    pointer-events: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.12s ease, transform 0.12s ease;
    transform-origin: center bottom;
    transform: translate(-50%, -100%) scale(0.96);
}

.custom-tooltip.show { 
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
}

/* Loading */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(51, 65, 85, 0.3);
    border-top-color: #f16334;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeInUp 0.5s ease-out forwards; }

/* Agent Filter Buttons */
.agent-filter-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(1);
}

.agent-filter-btn:hover {
    transform: scale(1.02);
}

.agent-filter-btn:active {
    transform: scale(0.98);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: #e2e8f0;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(241, 99, 52, 0.2);
    border-top-color: #f16334;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

.loading-text {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 8px;
    letter-spacing: 0.3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Filter Item */
.filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    direction: rtl;
    text-align: right;
}

.filter-item:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(51, 65, 85, 0.5);
}

.custom-checkbox {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #475569;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.custom-checkbox:checked {
    background: #f16334;
    border-color: #f16334;
}

.custom-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Sidebar Toggle */
.sidebar-toggle {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sidebar-collapsed {
    width: 70px !important;
}

.sidebar-collapsed .toggle-icon {
    transform: rotate(180deg);
}

.sidebar-collapsed-icon {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease 0.2s;
}

.sidebar-collapsed .sidebar-collapsed-icon {
    display: flex !important;
    opacity: 1;
}

.sidebar-collapsed .sidebar-content {
    opacity: 0;
    pointer-events: none;
}

.toggle-button {
    transition: all 0.3s ease;
}

.toggle-button:hover {
    transform: scale(1.1);
}

.collapsed-filter-icon {
    padding: 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.3);
    transition: all 0.3s;
    cursor: pointer;
}

.collapsed-filter-icon:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(241, 99, 52, 0.5);
    transform: translateX(-2px);
}

/* Agent Network Cards - Minimal Design */
.agent-network-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.5));
    border: 1px solid rgba(51, 65, 85, 0.5);
    border-radius: 8px;
    padding: 5px;
    transition: all 0.3s ease;
}

@media (min-width: 768px) {
    .agent-network-card {
        border-radius: 10px;
        padding: 7px;
    }
}

.agent-network-card:hover {
    border-color: rgba(6, 182, 212, 0.6);
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.7));
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
}

