/* IP Monitor - Custom Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 260px;
    --header-height: 64px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    margin: 0;
}

/* ========== HEADER ========== */
.app-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.app-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--gray-900);
    font-weight: 700;
    font-size: 18px;
}

.app-header .brand img {
    height: 40px;
}

.app-header .header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ========== SIDEBAR ========== */
.app-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--gray-200);
    padding: 24px 0;
    overflow-y: auto;
    z-index: 90;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.sidebar-nav li a.active {
    background: #eff6ff;
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar-nav li a i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-section {
    padding: 8px 24px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin-top: 16px;
}

/* ========== MAIN CONTENT ========== */
.app-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
}

.app-main.full-width {
    margin-left: 0;
}

/* ========== CARDS ========== */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--gray-200);
    transition: box-shadow 0.15s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.stat-card .stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-card .stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-card .stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-card .stat-icon.yellow { background: #fef3c7; color: var(--warning); }

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
}

/* ========== DEVICE CARDS (Public) ========== */
.device-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.device-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.device-card .status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: absolute;
    top: 16px;
    right: 16px;
}

.device-card .status-indicator.ok { background: var(--success); box-shadow: 0 0 8px rgba(22,163,74,0.4); }
.device-card .status-indicator.error { background: var(--danger); box-shadow: 0 0 8px rgba(220,38,38,0.4); animation: pulse-red 2s infinite; }
.device-card .status-indicator.pending { background: var(--gray-400); }

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 8px rgba(220,38,38,0.4); }
    50% { box-shadow: 0 0 16px rgba(220,38,38,0.6); }
}

.device-card .device-icon {
    font-size: 40px;
    margin-bottom: 12px;
    color: var(--gray-400);
}

.device-card .device-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.device-card .device-status {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

.device-card .device-status.ok { background: #dcfce7; color: var(--success); }
.device-card .device-status.error { background: #fee2e2; color: var(--danger); }
.device-card .device-status.pending { background: var(--gray-100); color: var(--gray-500); }

/* ========== TABLE ========== */
.table-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.table-card .table-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-card .table-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.table-card table {
    margin: 0;
}

.table-card table th {
    background: var(--gray-50);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 16px;
}

.table-card table td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-100);
}

.table-card table tbody tr:hover {
    background: var(--gray-50);
}

/* ========== STATUS BADGES ========== */
.badge-status {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-status.ok { background: #dcfce7; color: var(--success); }
.badge-status.error { background: #fee2e2; color: var(--danger); }
.badge-status.pending { background: var(--gray-100); color: var(--gray-500); }

.badge-method {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.badge-method.dns { background: #dbeafe; color: #1d4ed8; }
.badge-method.ping { background: var(--gray-100); color: var(--gray-600); }

/* ========== TIMELINE ========== */
.timeline-container {
    background: white;
    border-radius: 8px;
    padding: 16px;
}

.timeline-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.timeline-label {
    width: 160px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 12px;
}

.timeline-bar-bg {
    flex: 1;
    height: 24px;
    background: var(--gray-100);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.timeline-bar {
    position: absolute;
    height: 100%;
    background: var(--danger);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.timeline-bar:hover {
    opacity: 1;
}

/* ========== BUTTONS ========== */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ========== FORMS ========== */
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--gray-300);
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ========== MAP ========== */
#cy {
    width: 100%;
    height: calc(100vh - var(--header-height) - 160px);
    min-height: 500px;
    background: var(--gray-900);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
}

.map-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.map-legend {
    display: flex;
    gap: 16px;
    margin-left: auto;
    font-size: 13px;
    color: var(--gray-500);
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.map-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ========== LOGIN ========== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .app-sidebar { display: none; }
    .app-main { margin-left: 0; }
    .stat-card .stat-value { font-size: 24px; }
    .timeline-label { width: 100px; }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ========== MODAL ========== */
.modal-content {
    border-radius: 12px;
    border: none;
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
}

/* ========== DEVICE TYPE ICONS ========== */
.device-type-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 14px;
}

.device-type-icon.server { background: #dbeafe; color: #1d4ed8; }
.device-type-icon.router { background: #dcfce7; color: #16a34a; }
.device-type-icon.switch { background: #fef3c7; color: #d97706; }
.device-type-icon.workstation { background: #f3e8ff; color: #9333ea; }
.device-type-icon.voip { background: #ffe4e6; color: #e11d48; }
.device-type-icon.printer { background: #e0e7ff; color: #4f46e5; }
.device-type-icon.ap { background: #ccfbf1; color: #0d9488; }
.device-type-icon.nobreak { background: #fef9c3; color: #a16207; }
.device-type-icon.diverse { background: var(--gray-100); color: var(--gray-600); }
