/* Advanced Ping & Speed Test Tool - Modern Responsive CSS */
:root {
    --primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-dark: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    --secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --warning: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --info: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --dark: #1a202c;
    --light: #f7fafc;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border: #e2e8f0;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.tool-page {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 140px);
}

/* Header Section */
.tool-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 2rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.tool-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="25" cy="25" r="2" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="1.5" fill="%23ffffff" opacity="0.1"/><circle cx="10" cy="60" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="90" cy="40" r="2" fill="%23ffffff" opacity="0.1"/></svg>') repeat;
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-1%, -1%) rotate(90deg); }
    50% { transform: translate(1%, -2%) rotate(180deg); }
    75% { transform: translate(-2%, 1%) rotate(270deg); }
}

.tool-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.tool-header h1 i {
    margin-right: 0.75rem;
    color: #f093fb;
    font-size: 2.25rem;
}

.tool-description {
    font-size: 1.2rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
}

/* Test Sections Container */
.test-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Individual Test Sections */
.test-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: var(--transition);
    border-top: 4px solid transparent;
}

.ping-test {
    border-top-color: #667eea;
}

.speed-test {
    border-top-color: #22c55e;
}

.test-section:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.section-header {
    padding: 2rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--border);
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-header h2 i {
    font-size: 1.25rem;
    color: #667eea;
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.section-content {
    padding: 2rem;
}

/* Input Groups */
.input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.input-group input {
    flex: 1;
    min-width: 250px;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Advanced Input Features */
.input-with-suggestions {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.quick-hosts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.host-suggestion {
    padding: 0.375rem 0.75rem;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: var(--radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.host-suggestion:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    color: #667eea;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading States */
.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Sections */
.results {
    margin-top: 2rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
}

.results.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Statistics Display */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    padding: 1.5rem 1rem;
    border-radius: var(--radius);
    text-align: center;
    transition: var(--transition);
    border: 2px solid var(--border);
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--info);
}

.stat-item:hover {
    transform: translateY(-2px);
    border-color: #667eea;
    box-shadow: var(--shadow);
}

.stat-item .label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item .value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--info);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Advanced Ping Log */
.ping-log {
    background: var(--dark);
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: var(--radius);
    height: 250px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    border: 2px solid var(--border);
    position: relative;
}

.ping-log::before {
    content: 'Terminal';
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ping-log::-webkit-scrollbar {
    width: 8px;
}

.ping-log::-webkit-scrollbar-track {
    background: #2d3748;
    border-radius: 4px;
}

.ping-log::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

.ping-log::-webkit-scrollbar-thumb:hover {
    background: #667eea;
}

.ping-log .success {
    color: #68d391;
}

.ping-log .error {
    color: #fc8181;
}

.ping-log .info {
    color: #63b3ed;
}

/* Speed Test Gauges */
.speed-gauges {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.speed-gauge {
    text-align: center;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    padding: 2rem 1rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.speed-gauge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--success);
}

.speed-gauge:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: #22c55e;
}

.gauge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--success);
    border-radius: 50%;
    margin-bottom: 1rem;
    color: white;
    font-size: 1.5rem;
}

.gauge-label {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.875rem;
}

.gauge-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--success);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.gauge-unit {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: 400;
}

/* Progress Indicators */
.progress-container {
    margin: 1.5rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shimmer 1.5s infinite;
}

@keyframes progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Advanced Options */
.advanced-options {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    overflow: hidden;
    border-top: 4px solid #f59e0b;
}

.options-header {
    padding: 1.5rem 2rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--border);
}

.options-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.options-header h3 i {
    color: #f59e0b;
}

.options-content {
    padding: 2rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-group label i {
    color: #f59e0b;
    width: 16px;
}

.modern-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    cursor: pointer;
}

.modern-select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* Info Section Enhancement */
.info-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    border-top: 4px solid #3b82f6;
}

.info-header {
    padding: 2rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--border);
}

.info-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.info-header h3 i {
    color: #3b82f6;
}

.info-content {
    padding: 2rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.info-card {
    padding: 1.5rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-radius: var(--radius);
    border-left: 4px solid #3b82f6;
    transition: var(--transition);
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.info-card h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.info-card h4 i {
    color: #3b82f6;
    width: 20px;
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-card li::before {
    content: '•';
    color: #3b82f6;
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Network Quality Indicators */
.network-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
}

.network-status.excellent {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid #22c55e;
    color: #065f46;
}

.network-status.good {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid #22c55e;
    color: #065f46;
}

.network-status.fair {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid #f59e0b;
    color: #92400e;
}

.network-status.poor {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #991b1b;
}

/* History Chart Placeholder */
.ping-history {
    margin-top: 2rem;
    padding: 2rem;
    background: white;
    border-radius: var(--radius);
    border: 2px solid var(--border);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-chart {
    height: 200px;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .test-sections {
        grid-template-columns: 1fr;
    }
    
    .tool-header h1 {
        font-size: 2.25rem;
    }
    
    .speed-gauges {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .options-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .tool-page {
        padding: 1rem;
    }
    
    .tool-header {
        padding: 2rem 1rem;
        margin-bottom: 2rem;
    }
    
    .tool-header h1 {
        font-size: 2rem;
    }
    
    .tool-header h1 i {
        font-size: 1.75rem;
    }
    
    .tool-description {
        font-size: 1.1rem;
    }
    
    .section-header, 
    .section-content {
        padding: 1.5rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group input {
        min-width: auto;
    }
    
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.75rem;
    }
    
    .stat-item {
        padding: 1rem 0.75rem;
    }
    
    .stat-item .value {
        font-size: 1.25rem;
    }
    
    .speed-gauges {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .speed-gauge {
        padding: 1.5rem 1rem;
    }
    
    .gauge-value {
        font-size: 2rem;
    }
    
    .ping-log {
        height: 200px;
        padding: 1rem;
        font-size: 0.8rem;
    }
    
    .quick-hosts {
        justify-content: center;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .options-header,
    .info-header,
    .info-content,
    .options-content {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .tool-header {
        padding: 1.5rem 1rem;
    }
    
    .tool-header h1 {
        font-size: 1.75rem;
    }
    
    .tool-header h1 i {
        font-size: 1.5rem;
        margin-right: 0.5rem;
    }
    
    .tool-description {
        font-size: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.25rem;
    }
    
    .section-header,
    .section-content {
        padding: 1rem;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stat-item {
        padding: 0.75rem 0.5rem;
    }
    
    .stat-item .label {
        font-size: 0.75rem;
    }
    
    .stat-item .value {
        font-size: 1.1rem;
    }
    
    .gauge-value {
        font-size: 1.75rem;
    }
    
    .gauge-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .host-suggestion {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .ping-log {
        height: 150px;
        padding: 0.75rem;
        font-size: 0.75rem;
    }
    
    .options-header,
    .info-header,
    .info-content,
    .options-content {
        padding: 1rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .tool-header {
        background: white !important;
        color: black !important;
        box-shadow: none;
        border: 2px solid #ccc;
    }
    
    .test-section {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .ping-log {
        background: white !important;
        color: black !important;
        border: 1px solid #ccc;
    }
    
    .btn {
        display: none;
    }
    
    .advanced-options,
    .quick-hosts {
        display: none;
    }
}
