* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --secondary-color: #a78bfa;
    --success-color: #34d399;
    --error-color: #f87171;
    --warning-color: #fbbf24;
    --bg-gradient-start: #1e293b;
    --bg-gradient-end: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.95);
    --card-bg-hover: rgba(51, 65, 85, 0.95);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #475569;
    --input-bg: rgba(15, 23, 42, 0.8);
    --info-item-bg: rgba(51, 65, 85, 0.6);
    --info-item-bg-hover: rgba(71, 85, 105, 0.8);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    padding: 2rem 1rem;
    color: var(--text-primary);
    line-height: 1.6;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
}

.main-wrapper {
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    align-items: flex-start;
}

.content-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 100%;
    margin: 0;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.25rem;
    opacity: 0.8;
    font-weight: 300;
    color: var(--text-secondary);
}

.card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 30px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.05);
}

.card h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* IP Information Section */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-item {
    background: var(--info-item-bg);
    padding: 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    position: relative;
    transition: all 0.3s ease;
}

.info-item:hover {
    background: var(--info-item-bg-hover);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.info-item label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-item .value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
    min-height: 1.5rem;
}

.info-item .value .loading {
    color: var(--text-secondary);
    font-style: italic;
    font-weight: 400;
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
    font-weight: 500;
}

.copy-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn svg {
    width: 14px;
    height: 14px;
}

.refresh-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.refresh-btn:active {
    transform: translateY(0);
}

.refresh-btn svg {
    animation: none;
}

.refresh-btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Port Testing Section */
.test-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    gap: 0.5rem;
}

.input-wrapper input {
    flex: 1;
}

.port-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.port-input-wrapper input {
    flex: 1;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}

input[type="text"]::placeholder,
input[type="number"]::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
    background: rgba(15, 23, 42, 0.9);
}

.protocol-select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    background: var(--input-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f1f5f9' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 120px;
    appearance: none;
}

.protocol-select:hover {
    border-color: var(--primary-color);
    background-color: rgba(15, 23, 42, 0.9);
}

.protocol-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
    background-color: rgba(15, 23, 42, 0.9);
}

.use-my-ip-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.use-my-ip-btn:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.use-my-ip-btn:active {
    transform: translateY(0);
}

.test-btn {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.test-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.test-btn:active {
    transform: translateY(0);
}

.test-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.test-results {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--info-item-bg);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.test-results h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.result-content {
    font-family: 'Courier New', monospace;
    background: rgba(15, 23, 42, 0.8);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-primary);
}

.result-success {
    border-left: 4px solid var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.result-error {
    border-left: 4px solid var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.result-warning {
    border-left: 4px solid var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

/* Google Ads Sidebar */
.ads-sidebar {
    width: 300px;
    flex-shrink: 0;
    position: relative;
    margin-top: 2rem;
}

.ads-container {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.ads-label {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

.ads-placeholder {
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--info-item-bg);
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    overflow: hidden;
}

.ads-placeholder:hover {
    border-color: var(--primary-color);
    background: var(--info-item-bg-hover);
}

.ads-placeholder ins {
    display: block;
    width: 100%;
    min-height: 600px;
}

/* Site Footer */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.site-footer p {
    margin: 0;
    font-size: 0.9375rem;
}

.domain-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.domain-link:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-wrapper {
        flex-direction: column;
    }

    .ads-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
    }

    .ads-container {
        position: relative;
    }

    .ads-placeholder {
        min-height: 250px;
    }

    .ads-placeholder ins {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .port-input-wrapper {
        flex-direction: column;
    }

    .protocol-select {
        width: 100%;
    }

    .use-my-ip-btn {
        width: 100%;
        justify-content: center;
    }

    .main-wrapper {
        gap: 1.5rem;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    font-weight: 500;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

