/* ==========================================================================
   AetherPing V3 Next-Gen Aesthetics (Design System & CSS Rules)
   ========================================================================== */

/* Variables & Base Styles */
:root {
    --bg-dark: #08090b;
    --bg-card: rgba(13, 17, 23, 0.45);
    --border-glass: rgba(255, 255, 255, 0.05);
    --border-glass-hover: rgba(255, 255, 255, 0.12);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Glowing accents */
    --color-primary: #06b6d4;      /* Cyan */
    --color-secondary: #a855f7;    /* Violet */
    --color-success: #10b981;      /* Emerald */
    --color-rose: #f43f5e;         /* Rose */
    --color-amber: #f59e0b;        /* Amber */
    
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow-cyan: 0 0 20px 2px rgba(6, 182, 212, 0.25);
    
    --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* Floating Blur Backdrops */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.bg-glow-1 {
    width: 50vw;
    height: 50vw;
    top: -10vw;
    left: -10vw;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
    animation: float-slow 25s ease-in-out infinite alternate;
}

.bg-glow-2 {
    width: 40vw;
    height: 40vw;
    bottom: -5vw;
    right: -5vw;
    background: radial-gradient(circle, var(--color-secondary) 0%, transparent 70%);
    animation: float-slow 35s ease-in-out infinite alternate-reverse;
}

.bg-glow-3 {
    width: 30vw;
    height: 30vw;
    top: 30%;
    left: 60%;
    background: radial-gradient(circle, var(--color-success) 0%, transparent 70%);
    animation: float-slow 20s ease-in-out infinite alternate;
}

@keyframes float-slow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(8%, 12%) scale(1.15); }
}

/* Core Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* App Header styling */
.app-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 8px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    padding: 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
    animation: pulse-glow 2.5s infinite ease-in-out;
}

.logo-icon i {
    width: 24px;
    height: 24px;
    color: #fff;
    stroke-width: 2.5px;
}

.logo-text h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 2px;
}

.logo-text h1 span {
    color: var(--color-primary);
    -webkit-text-fill-color: var(--color-primary);
}

.version-badge {
    font-size: 10px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--color-primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

.subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 15px rgba(6, 182, 212, 0.3); }
    50% { box-shadow: 0 0 25px rgba(6, 182, 212, 0.6); }
}

/* Glassmorphism Card System */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 18px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-glass);
    padding: 24px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    border-color: var(--border-glass-hover);
}

/* Control Panel Section */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 18px;
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    pointer-events: none;
    transition: color 0.3s ease;
}

#target-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 18px 18px 18px 52px;
    font-size: 16px;
    color: #fff;
    outline: none;
    font-family: var(--font-sans);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#target-input:focus {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow-cyan);
}

#target-input:focus + .input-icon {
    color: var(--color-primary);
}

/* Controls Grid (Forms Row) */
.controls-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.select-wrapper {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.select-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

#ip-version {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 16px 14px 44px;
    font-size: 14px;
    color: #fff;
    outline: none;
    cursor: pointer;
    font-family: var(--font-sans);
    appearance: none;
    transition: border-color 0.3s ease;
}

#ip-version:focus {
    border-color: var(--color-primary);
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-secondary);
    pointer-events: none;
}

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.25s ease;
    font-family: var(--font-sans);
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), #0891b2);
    color: #fff;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

/* Presets section */
.presets-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 16px;
}

.preset-label {
    color: var(--text-secondary);
}

.preset-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.preset-badge:hover {
    background: rgba(6, 182, 212, 0.08);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* DNS / Geolocation Resolution Banner */
.resolution-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border-left: 4px solid var(--color-primary);
    padding: 16px 24px;
}

.resolve-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.resolve-icon {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}

.resolve-details {
    display: flex;
    flex-direction: column;
}

.resolve-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
}

.resolve-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
}

/* Pulse Glowing Indicators */
.status-indicator-glowing {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    background: rgba(6, 182, 212, 0.08);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(6, 182, 212, 0.15);
}

.status-indicator-glowing.success {
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.15);
}

.status-indicator-glowing.success .pulse-dot {
    background: var(--color-success);
}

.status-indicator-glowing.success .pulse-ring {
    border-color: var(--color-success);
}

.pulse-ring {
    width: 8px;
    height: 8px;
    border: 1px solid var(--color-primary);
    border-radius: 50%;
    position: absolute;
    animation: status-pulsate 1.5s infinite ease-out;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
    z-index: 1;
}

@keyframes status-pulsate {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2.8); opacity: 0; }
}

/* Stats Overview Cards */
.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.stat-icon {
    width: 18px;
    height: 18px;
}

.text-cyan { color: var(--color-primary); }
.text-purple { color: var(--color-secondary); }
.text-emerald { color: var(--color-success); }
.text-rose { color: var(--color-rose); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-family: var(--font-mono);
}

.stat-value .unit {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 2px;
}

.stat-subtext {
    font-size: 12px;
    color: var(--text-muted);
}

/* Filter & Search Panel Card */
.filter-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filter-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-search-icon {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

#filter-search {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px 14px 12px 42px;
    font-size: 14px;
    color: #fff;
    outline: none;
    font-family: var(--font-sans);
    transition: border-color 0.25s ease;
}

#filter-search:focus {
    border-color: var(--color-primary);
}

.filter-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.pill-btn.active {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 8px;
}

/* Diagnostics Table Cards & Layout */
.table-card {
    padding: 0;
    overflow: hidden;
}

.table-container {
    overflow-x: auto;
    width: 100%;
}

.diagnostics-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.diagnostics-table th {
    background: rgba(15, 23, 42, 0.2);
    padding: 18px 24px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    user-select: none;
}

.diagnostics-table th.sortable {
    cursor: pointer;
    transition: color 0.2s ease;
}

.diagnostics-table th.sortable:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
}

.sort-icon {
    width: 13px;
    height: 13px;
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
    opacity: 0.5;
}

.diagnostics-table td {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.diagnostics-table tr {
    transition: background-color 0.2s ease;
}

.diagnostics-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.015);
}

/* Location and Provider formatting */
.location-cell {
    font-weight: 600;
    color: var(--text-primary);
}

.country-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.flag-emoji {
    font-size: 16px;
    line-height: 1;
}

.provider-cell {
    color: var(--text-secondary);
    font-size: 13px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.provider-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.provider-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.latency-value {
    font-family: var(--font-mono);
    font-weight: 500;
}

/* Ping Sequence Block Items */
.sequence-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ping-block {
    width: 10px;
    height: 16px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.ping-block.waiting {
    background: rgba(255, 255, 255, 0.05);
}

.ping-block.pinging {
    background: var(--color-amber);
    box-shadow: 0 0 8px var(--color-amber);
    animation: block-pulse 0.8s infinite alternate;
}

.ping-block.success {
    background: var(--color-success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

.ping-block.lost {
    background: var(--color-rose);
    box-shadow: 0 0 6px rgba(244, 63, 94, 0.4);
}

.ping-block.timeout {
    background: rgba(244, 63, 94, 0.2);
    border: 1px solid var(--color-rose);
}

@keyframes block-pulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Empty State / Offline design */
.empty-state-row td {
    padding: 60px 24px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.empty-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 400px;
}

/* Sorting State Header Styles */
th.sorted-asc .sort-icon {
    opacity: 1;
    color: var(--color-primary);
    transform: rotate(180deg);
}

th.sorted-desc .sort-icon {
    opacity: 1;
    color: var(--color-primary);
}

/* Toast System (Dynamic Notifications) */
#toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    color: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    min-width: 250px;
    max-width: 380px;
    transform: translateY(50px);
    opacity: 0;
    animation: toast-fade-in 0.3s forwards ease-out;
    border-left: 4px solid var(--color-primary);
}

.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-rose); }
.toast.info { border-left-color: var(--color-secondary); }

.toast-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--color-success); }
.toast.error .toast-icon { color: var(--color-rose); }
.toast.info .toast-icon { color: var(--color-secondary); }

@keyframes toast-fade-in {
    to { transform: translateY(0); opacity: 1; }
}

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

@keyframes toast-fade-out {
    to { transform: translateY(20px); opacity: 0; }
}

/* Hide helper class */
.hidden {
    display: none !important;
}

/* ==========================================================================
   Responsive Adaptations & Touch Optimization
   ========================================================================== */
@media (max-width: 992px) {
    .app-container {
        padding: 24px 16px;
    }
    
    .stats-overview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-header {
        align-items: center;
        text-align: center;
    }
    
    .controls-row {
        flex-direction: column;
    }
    
    .select-wrapper, .btn {
        width: 100%;
    }
    
    .presets-container {
        justify-content: center;
    }

    .filter-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-buttons {
        justify-content: flex-end;
    }

    .stats-overview-grid {
        grid-template-columns: 1fr;
    }

    .diagnostics-table th, .diagnostics-table td {
        padding: 12px 14px;
    }
}

/* Custom Table Scrollbar styling */
.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
