/**
 * GamesGuider Ping & Latency Calculator Styles
 * Version: 1.0.0
 */

/* Root Variables */
:root {
    --gg-primary: #3b82f6;
    --gg-success: #10b981;
    --gg-warning: #f59e0b;
    --gg-danger: #ef4444;
    --gg-text-primary: #1f2937;
    --gg-text-secondary: #6b7280;
    --gg-border: #e5e7eb;
    --gg-bg-card: #ffffff;
    --gg-bg-secondary: #f9fafb;
    --gg-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --gg-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --gg-radius: 8px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --gg-text-primary: #f9fafb;
        --gg-text-secondary: #d1d5db;
        --gg-border: #374151;
        --gg-bg-card: #1f2937;
        --gg-bg-secondary: #111827;
    }
}

/* Main Wrapper */
.gamesguider-calculator-wrapper {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--gg-text-primary);
}

/* Header */
.gg-calc-header {
    text-align: center;
    margin-bottom: 2rem;
}

.gg-calc-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gg-text-primary);
}

.gg-calc-description {
    font-size: 1.125rem;
    color: var(--gg-text-secondary);
    margin-bottom: 0.5rem;
}

.gg-calc-intro {
    font-size: 1rem;
    color: var(--gg-text-secondary);
}

/* Card Component */
.gg-calc-card {
    background: var(--gg-bg-card);
    border-radius: var(--gg-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--gg-shadow);
    border: 1px solid var(--gg-border);
}

.gg-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--gg-text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Input Section */
.gg-calc-input-section {
    margin-bottom: 2rem;
}

.gg-calc-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--gg-text-primary);
}

.gg-icon {
    font-size: 1.25rem;
}

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

.gg-calc-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 1rem;
    font-size: 1.125rem;
    border: 2px solid var(--gg-border);
    border-radius: var(--gg-radius);
    background: var(--gg-bg-card);
    color: var(--gg-text-primary);
    transition: all 0.2s;
}

.gg-calc-input:focus {
    outline: none;
    border-color: var(--gg-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.gg-calc-input.error {
    border-color: var(--gg-danger);
}

.gg-input-suffix {
    position: absolute;
    right: 1rem;
    color: var(--gg-text-secondary);
    font-weight: 600;
}

.gg-input-hint {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gg-text-secondary);
}

.gg-input-error {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--gg-danger);
    display: none;
}

.gg-input-error.show {
    display: block;
}

/* Buttons */
.gg-calc-button {
    width: 100%;
    margin-top: 1rem;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--gg-primary) 0%, #2563eb 100%);
    border: none;
    border-radius: var(--gg-radius);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.gg-calc-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--gg-shadow-lg);
}

.gg-calc-button:active {
    transform: translateY(0);
}

.gg-calc-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.gg-btn-icon {
    font-size: 1.25rem;
}

/* Results Section */
.gg-results-section {
    animation: fadeIn 0.3s ease-in;
}

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

/* Rating Badge */
.gg-rating-card {
    background: linear-gradient(135deg, var(--gg-bg-card) 0%, var(--gg-bg-secondary) 100%);
}

.gg-rating-badge {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.gg-rating-icon {
    font-size: 4rem;
    line-height: 1;
}

.gg-rating-text {
    flex: 1;
}

.gg-rating-label {
    display: block;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gg-text-secondary);
    margin-bottom: 0.25rem;
}

.gg-rating-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.25rem 0;
}

.gg-rating-description {
    font-size: 1rem;
    color: var(--gg-text-secondary);
    margin: 0;
}

/* Latency Breakdown */
.gg-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.gg-breakdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--gg-bg-secondary);
    border-radius: calc(var(--gg-radius) - 2px);
    border: 1px solid var(--gg-border);
}

.gg-breakdown-label {
    font-size: 0.875rem;
    color: var(--gg-text-secondary);
    margin-bottom: 0.5rem;
}

.gg-breakdown-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gg-primary);
}

/* Experience List */
.gg-experience-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gg-experience-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gg-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.gg-experience-list li:last-child {
    border-bottom: none;
}

.gg-experience-list li::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--gg-success);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    flex-shrink: 0;
}

/* Games Grid */
.gg-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.gg-game-tag {
    padding: 0.75rem 1rem;
    background: var(--gg-bg-secondary);
    border: 1px solid var(--gg-border);
    border-radius: calc(var(--gg-radius) - 2px);
    text-align: center;
    font-weight: 500;
    color: var(--gg-text-primary);
    transition: all 0.2s;
}

.gg-game-tag:hover {
    background: var(--gg-primary);
    color: white;
    border-color: var(--gg-primary);
}

/* Tips Card */
.gg-tips-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #fbbf24;
}

.gg-tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gg-tips-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(251, 191, 36, 0.3);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.gg-tips-list li:last-child {
    border-bottom: none;
}

.gg-tips-list li::before {
    content: '💡';
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

/* Action Buttons */
.gg-calc-actions {
    display: flex;
    gap: 0.75rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.gg-action-btn {
    flex: 1;
    min-width: 140px;
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--gg-radius);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 2px solid var(--gg-border);
    background: var(--gg-bg-card);
    color: var(--gg-text-primary);
}

.gg-action-btn:hover {
    border-color: var(--gg-primary);
    color: var(--gg-primary);
    transform: translateY(-2px);
    box-shadow: var(--gg-shadow);
}

.gg-action-btn:active {
    transform: translateY(0);
}

/* Educational Section */
.gg-educational-section {
    margin: 3rem 0;
}

.gg-educational-card h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--gg-text-primary);
}

.gg-educational-card p {
    line-height: 1.7;
    color: var(--gg-text-secondary);
}

/* Related Articles */
.gg-related-articles {
    margin: 3rem 0;
}

.gg-related-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gg-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.gg-article-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--gg-bg-card);
    border: 1px solid var(--gg-border);
    border-radius: var(--gg-radius);
    text-decoration: none;
    color: var(--gg-text-primary);
    transition: all 0.2s;
}

.gg-article-card:hover {
    border-color: var(--gg-primary);
    box-shadow: var(--gg-shadow);
    transform: translateY(-2px);
}

.gg-article-icon {
    font-size: 1.5rem;
}

.gg-article-title {
    flex: 1;
    font-weight: 500;
}

.gg-article-arrow {
    color: var(--gg-primary);
    font-weight: 700;
}

/* Disclaimer */
.gg-disclaimer {
    margin-top: 3rem;
    padding: 1rem;
    background: var(--gg-bg-secondary);
    border-radius: var(--gg-radius);
    border: 1px solid var(--gg-border);
    text-align: center;
}

.gg-disclaimer p {
    margin: 0;
    color: var(--gg-text-secondary);
}

/* Responsive Design */
@media (max-width: 640px) {
    .gg-calc-title {
        font-size: 1.5rem;
    }

    .gg-calc-description {
        font-size: 1rem;
    }

    .gg-calc-card {
        padding: 1rem;
    }

    .gg-rating-badge {
        flex-direction: column;
        text-align: center;
    }

    .gg-breakdown-grid {
        grid-template-columns: 1fr;
    }

    .gg-games-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .gg-calc-actions {
        flex-direction: column;
    }

    .gg-action-btn {
        width: 100%;
    }

    .gg-articles-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .gg-calc-button,
    .gg-calc-actions,
    .gg-related-articles {
        display: none !important;
    }

    .gg-calc-card {
        page-break-inside: avoid;
    }
}

/* Accessibility */
.gg-calc-input:focus,
.gg-calc-button:focus,
.gg-action-btn:focus {
    outline: 2px solid var(--gg-primary);
    outline-offset: 2px;
}

/* Loading State */
.gg-calc-button.loading {
    position: relative;
    color: transparent;
}

.gg-calc-button.loading::after {
    content: '';
    position: absolute;
    width: 1.5rem;
    height: 1.5rem;
    top: 50%;
    left: 50%;
    margin-left: -0.75rem;
    margin-top: -0.75rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

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

/* Success Message */
.gg-success-message {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--gg-success);
    color: white;
    border-radius: var(--gg-radius);
    box-shadow: var(--gg-shadow-lg);
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

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


/* Live Test Feature Styles */

/* Method Selector */
.gg-method-selector {
    margin-bottom: 1rem;
    padding: 0.5rem;
}

.gg-method-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    background: var(--gg-bg-secondary);
    padding: 0.25rem;
    border-radius: var(--gg-radius);
}

.gg-method-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    border-radius: calc(var(--gg-radius) - 2px);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gg-text-secondary);
    transition: all 0.2s;
}

.gg-method-tab:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--gg-primary);
}

.gg-method-tab.active {
    background: white;
    color: var(--gg-primary);
    box-shadow: var(--gg-shadow);
}

.gg-tab-icon {
    font-size: 1.25rem;
}

.gg-tab-text {
    font-weight: 600;
}

/* Input Panels */
.gg-input-panel {
    display: none;
}

.gg-input-panel.active {
    display: block;
}

/* Server Select */
.gg-calc-select {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1.125rem;
    border: 2px solid var(--gg-border);
    border-radius: var(--gg-radius);
    background: var(--gg-bg-card);
    color: var(--gg-text-primary);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.75rem;
}

.gg-calc-select:focus {
    outline: none;
    border-color: var(--gg-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Test Progress */
.gg-test-progress {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--gg-bg-secondary);
    border-radius: calc(var(--gg-radius) - 2px);
    border: 2px solid var(--gg-primary);
}

.gg-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gg-bg-card);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.gg-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gg-primary) 0%, #2563eb 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.gg-progress-text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--gg-text-primary);
    font-weight: 600;
    text-align: center;
}

/* Live Test Button */
.gg-live-test-button {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.gg-live-test-button:hover {
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
}

.gg-live-test-button:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
}

/* Test Info */
.gg-test-info {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--gg-bg-secondary);
    border-radius: calc(var(--gg-radius) - 2px);
    border-left: 4px solid var(--gg-primary);
}

.gg-test-info p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--gg-text-secondary);
    line-height: 1.5;
}

.gg-test-info strong {
    color: var(--gg-text-primary);
}

/* Live Test Results Enhancement */
.gg-results-section.live-test .gg-rating-card {
    background: linear-gradient(135deg, #e0f2fe 0%, #bfdbfe 100%);
    border-left: 4px solid var(--gg-primary);
}

.gg-test-details {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--gg-bg-secondary);
    border-radius: calc(var(--gg-radius) - 2px);
}

.gg-test-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.gg-test-detail-item {
    text-align: center;
}

.gg-test-detail-label {
    display: block;
    font-size: 0.75rem;
    color: var(--gg-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.gg-test-detail-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gg-primary);
}

/* Server Badge */
.gg-server-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gg-bg-secondary);
    border-radius: calc(var(--gg-radius) - 2px);
    font-size: 0.875rem;
    color: var(--gg-text-primary);
    margin-top: 0.5rem;
}

.gg-server-badge::before {
    content: '🌐';
    font-size: 1rem;
}

/* Responsive Updates */
@media (max-width: 640px) {
    .gg-method-tabs {
        grid-template-columns: 1fr;
    }
    
    .gg-test-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animation for live test */
@keyframes testPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.gg-live-test-button.testing {
    animation: testPulse 2s ease-in-out infinite;
}
