:root {
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #ffffff;
    --border-color: #e9ecef;
    --info-bg: #f8f9fa;
    --info-border: #667eea;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-light: rgba(0, 0, 0, 0.2);
    --spinner-bg: #f3f3f3;
    --code-bg: #333333;
    --code-text: #00ff00;
    --error-color: #dc3545;
    --success-color: #28a745;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-gradient-start: #1a1a2e;
        --bg-gradient-end: #16213e;
        --card-bg: #0f3460;
        --text-primary: #e4e4e4;
        --text-secondary: #b8b8b8;
        --text-light: #ffffff;
        --border-color: #1a1a2e;
        --info-bg: #1a1a2e;
        --info-border: #667eea;
        --shadow: rgba(0, 0, 0, 0.6);
        --shadow-light: rgba(0, 0, 0, 0.4);
        --spinner-bg: #1a1a2e;
        --code-bg: #0a0a0a;
        --code-text: #00ff00;
        --error-color: #ff6b6b;
        --success-color: #51cf66;
    }
}

:root[data-theme="dark"] {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --card-bg: #0f3460;
    --text-primary: #e4e4e4;
    --text-secondary: #b8b8b8;
    --text-light: #ffffff;
    --border-color: #1a1a2e;
    --info-bg: #1a1a2e;
    --info-border: #667eea;
    --shadow: rgba(0, 0, 0, 0.6);
    --shadow-light: rgba(0, 0, 0, 0.4);
    --spinner-bg: #1a1a2e;
    --code-bg: #0a0a0a;
    --code-text: #00ff00;
    --error-color: #ff6b6b;
    --success-color: #51cf66;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px var(--shadow-light);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.globe-icon {
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.globe-icon span {
    font-size: 1.5rem;
}

.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.theme-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(20deg);
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px var(--shadow);
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid var(--spinner-bg);
    border-top: 4px solid var(--info-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.ip-display {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    border-radius: 15px;
    color: var(--text-light);
}

.ip-display h2 {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.label {
    font-size: 1rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    background: var(--info-bg);
    border-radius: 10px;
    border-left: 4px solid var(--info-border);
}

.info-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.info-value {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.btn {
    flex: 1;
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-light);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.api-info {
    background: var(--info-bg);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

.api-info h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.api-info code {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 8px 15px;
    border-radius: 5px;
    display: block;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
}

.api-example {
    margin-top: 10px;
    color: var(--text-secondary);
}

.api-example a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.api-example a:hover {
    text-decoration: underline;
}

.api-examples {
    margin-top: 20px;
}

.code-example {
    margin-bottom: 15px;
}

.code-example h4 {
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.error {
    text-align: center;
    padding: 40px;
    color: var(--error-color);
}

.error h3 {
    margin-bottom: 15px;
}

.error p {
    margin-bottom: 20px;
}

footer {
    text-align: center;
    color: white;
    margin-top: 20px;
    opacity: 0.9;
}

footer .copyright {
    margin-top: 10px;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }

    .card {
        padding: 20px;
    }

    .ip-display h2 {
        font-size: 2rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
    }

    .theme-icon {
        font-size: 1.3rem;
    }
}
