/* SIP Honeypot Dashboard Styles */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --bg-dark: #1e293b;
    --bg-darker: #0f172a;
    --bg-card: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #475569;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-darker);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Utility */
.hidden { display: none !important; }

/* Login Page */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: var(--bg-dark);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--primary);
}

.login-container .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    background: var(--bg-card);
    color: var(--text-primary);
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

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

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Error messages */
.error-message {
    color: var(--danger);
    font-size: 14px;
    margin-bottom: 15px;
    min-height: 20px;
}

/* Dashboard Layout */
#dashboard-page {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    color: var(--primary);
    font-size: 20px;
}

.nav-menu {
    list-style: none;
    padding: 10px 0;
    flex: 1;
}

.nav-menu li a {
    display: block;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-menu li a:hover,
.nav-menu li a.active {
    background: var(--bg-card);
    color: var(--text-primary);
    border-left: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Main Content */
.content {
    flex: 1;
    margin-left: 250px;
    padding: 30px;
}

.view {
    max-width: 1400px;
}

.view h1 {
    margin-bottom: 25px;
    font-size: 28px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-dark);
    padding: 25px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.stat-card h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.stat-card.highlight {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a2a1a 100%);
    border-color: var(--success);
}

.stat-card.highlight .stat-value {
    color: var(--success);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* Cards */
.card {
    background: var(--bg-dark);
    padding: 25px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.card h3 {
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--text-secondary);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-darker);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
}

.data-table {
    background: var(--bg-dark);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: var(--bg-card);
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
    width: auto;
    min-width: 200px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    color: var(--text-secondary);
}

/* Export Preview */
.export-preview {
    margin-top: 20px;
    background: var(--bg-darker);
    border-radius: 8px;
    border: 1px solid var(--border);
    max-height: 400px;
    overflow: auto;
}

.export-preview pre {
    padding: 20px;
    margin: 0;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-dark);
    padding: 30px;
    border-radius: 12px;
    min-width: 400px;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal h2 {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Report details modal */
.report-details {
    max-height: 70vh;
    overflow-y: auto;
}

.report-meta {
    background: var(--bg-darker);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.report-meta p {
    margin-bottom: 8px;
}

.report-meta p:last-child {
    margin-bottom: 0;
}

.email-preview {
    background: var(--bg-darker);
    padding: 20px;
    border-radius: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

/* Status badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.badge-sip {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.badge-http {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.badge-tftp {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

.badge-default {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.badge-internal {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.badge-external {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.badge-both {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.badge-ringing {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    animation: pulse 1.5s ease-in-out infinite;
}

.badge-answered {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Empty message styling */
.empty-message {
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* Active sessions card */
#active-sessions-card {
    margin-bottom: 20px;
}

#active-sessions-table {
    display: none;
}

#active-sessions-card.has-sessions #active-sessions-table {
    display: table;
}

#active-sessions-card.has-sessions #no-active-sessions {
    display: none;
}

#active-sessions-pagination {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* Progress bar for sessions */
.progress-bar {
    background: var(--bg-darker);
    border-radius: 4px;
    height: 20px;
    width: 100%;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    min-width: 30px;
}

/* IP Address styling */
.ip-address {
    font-family: 'Monaco', 'Menlo', monospace;
    background: var(--bg-darker);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
}

/* Public blocklist URLs */
.public-lists {
    margin-bottom: 20px;
}

.public-lists h3 {
    margin-bottom: 10px;
}

.public-lists p {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.public-list-urls {
    list-style: none;
    padding: 0;
    margin: 0;
}

.public-list-urls li {
    padding: 8px 12px;
    background: var(--bg-darker);
    border-radius: 4px;
    margin-bottom: 8px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
}

.public-list-urls a {
    color: var(--primary);
    text-decoration: none;
}

.public-list-urls a:hover {
    text-decoration: underline;
}

/* Abuse Reports */
.abuse-status-card {
    margin-bottom: 20px;
}

.config-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.config-status.configured {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.config-status.not-configured {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.config-status .status-icon {
    font-size: 18px;
    font-weight: bold;
}

.abuse-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.abuse-stats .stat {
    background: var(--bg-darker);
    padding: 8px 15px;
    border-radius: 4px;
}

.config-example {
    background: var(--bg-darker);
    padding: 15px;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    overflow-x: auto;
}

.abuse-report-form .form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.abuse-report-form input {
    flex: 1;
}

.abuse-contact-info {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-darker);
    border-radius: 6px;
}

.abuse-contact-details table {
    width: 100%;
    margin-bottom: 15px;
}

.abuse-contact-details td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.abuse-contact-details td:first-child {
    width: 150px;
    color: var(--text-muted);
}

.abuse-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.abuse-error {
    color: #f87171;
    padding: 10px;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 4px;
}

.cooldown-notice {
    color: var(--warning);
    font-size: 13px;
}

.help-text {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 10px;
}

/* Settings Page */
#settings-view .card {
    margin-bottom: 20px;
}

#settings-view .form-row {
    display: flex;
    gap: 15px;
}

#settings-view .form-row .form-group {
    flex: 1;
}

#settings-view .form-group {
    margin-bottom: 15px;
}

#settings-view .form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 13px;
}

#settings-view .form-group input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 14px;
}

#settings-view .form-group input:focus {
    border-color: var(--primary);
    outline: none;
}

.settings-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.test-result, .save-result {
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 4px;
}

.test-result.success, .save-result.success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.test-result.error, .save-result.error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* Action buttons in tables */
.action-btn {
    padding: 4px 10px;
    margin-right: 5px;
    font-size: 12px;
}

/* Log details */
.log-details {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-darker);
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    white-space: pre-wrap;
    max-height: 300px;
    overflow: auto;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header h2,
    .nav-menu li a span,
    .sidebar-footer span {
        display: none;
    }

    .nav-menu li a {
        text-align: center;
        padding: 15px;
    }

    .content {
        margin-left: 60px;
    }
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: var(--bg-dark);
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 10px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Textarea for bulk import */
textarea {
    min-height: 150px;
    resize: vertical;
}

/* IP Details Modal */
.ip-details-table {
    width: 100%;
    margin: 15px 0;
}

.ip-details-table td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
}

.ip-details-table td:first-child {
    width: 140px;
    color: var(--text-secondary);
}

.ip-details-loading {
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
}

.ip-details-error {
    padding: 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: 6px;
    color: var(--danger);
    margin: 15px 0;
}

/* Analytics Section */
.section-title {
    margin: 40px 0 20px 0;
    font-size: 20px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.country-flag {
    font-size: 18px;
    margin-right: 8px;
}

.asn-badge {
    font-family: 'Monaco', 'Menlo', monospace;
    background: var(--bg-darker);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary);
}

.status-text {
    margin-left: 15px;
    color: var(--text-secondary);
    font-size: 14px;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-style: italic;
}

/* External Blocklist Sources (APIBAN, etc) */
.external-lists {
    margin-bottom: 20px;
}

.external-list-item {
    background: var(--bg-darker);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
}

.external-list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.external-list-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.external-list-info strong {
    font-size: 16px;
    color: var(--text-primary);
}

.external-list-info .help-text {
    color: var(--text-secondary);
    margin-bottom: 0;
}

.external-list-info .external-link {
    color: var(--primary);
    font-size: 12px;
    text-decoration: none;
}

.external-list-info .external-link:hover {
    text-decoration: underline;
}

.external-list-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.external-list-status .stat-small {
    color: var(--text-secondary);
    font-size: 12px;
}

.external-list-config {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.external-list-config .form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.external-list-config .form-group {
    flex: 1;
    margin-bottom: 0;
}

.external-list-config .checkbox-group {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.external-list-config .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-primary);
}

.external-list-config input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.external-list-config .button-group {
    margin-bottom: 0;
}

.sync-info {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: 10px;
}

.sync-error {
    color: var(--danger);
    font-size: 12px;
    display: block;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
}

/* Attack Map Styles */
.attack-map-card {
    margin-bottom: 20px;
}

.attack-map-card h3 {
    margin-bottom: 10px;
}

.map-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

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

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.origin {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

.legend-dot.destination {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}

#attack-map {
    height: 400px;
    width: 100%;
    border-radius: 8px;
    background: #0f172a;
    overflow: hidden;
}

/* Dark theme for Leaflet */
.leaflet-container {
    background: #0f172a !important;
    font-family: inherit;
}

.leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9);
}

.leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.8) !important;
    color: var(--text-secondary) !important;
    font-size: 10px;
}

.leaflet-control-attribution a {
    color: var(--primary) !important;
}

.leaflet-control-zoom {
    border: none !important;
}

.leaflet-control-zoom a {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-dark) !important;
}

/* Attack arc animation */
.attack-arc {
    stroke-dasharray: 10, 5;
    animation: dash 1s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -15;
    }
}

/* Pulsing markers */
.pulse-marker {
    animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: scale(2);
    }
}

.attack-popup .leaflet-popup-content-wrapper {
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 8px;
}

.attack-popup .leaflet-popup-tip {
    background: var(--card-bg);
}

