:root {
    /* Brand (legacy light palette for compatibility) */
    --primary-blue: #1B263B;
    --accent-cyan: #2EC4B6;
    --text-black: #111111;
    --warm-gray: #F5F6FA;
    --divider-gray: #E0E1E6;
    --icon-gray: #B0B3B8;
    --white: #fff;

    /* Dark Theme Variables */
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 8%;
    --card-foreground: 0 0% 98%;
    --card-border: 240 10% 16%;
    --popover: 240 10% 8%;
    --popover-foreground: 0 0% 98%;
    --primary: 217 91% 60%;
    --primary-foreground: 0 0% 98%;
    --primary-glow: 217 91% 70%;
    --secondary: 240 10% 16%;
    --secondary-foreground: 0 0% 98%;
    --muted: 240 10% 16%;
    --muted-foreground: 240 5% 65%;
    --accent: 142 76% 36%;
    --accent-foreground: 0 0% 98%;
    --accent-glow: 142 76% 46%;
    --success: 142 76% 36%;
    --success-foreground: 0 0% 98%;
    --warning: 48 96% 53%;
    --warning-foreground: 240 10% 3.9%;
    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 98%;
    --border: 240 10% 16%;
    --input: 240 10% 16%;
    --ring: 217 91% 60%;
    --radius: 0.75rem;

    /* Derived tokens */
    --gradient-primary: linear-gradient(135deg, hsl(217 91% 60%), hsl(217 91% 70%));
    --gradient-primary-hover: linear-gradient(135deg, hsl(217 91% 65%), hsl(217 91% 75%));
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --shadow-glow: 0 0 20px hsl(217 91% 60% / 0.3);
    --shadow-glow-intense: 0 0 30px hsl(217 91% 60% / 0.45);
}

* { box-sizing: border-box; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Navigation */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: hsl(var(--card) / 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid hsl(var(--card-border) / 0.3);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: hsl(var(--foreground));
}

.nav-logo-img {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: calc(var(--radius) - 2px);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: hsl(var(--muted-foreground));
    font-weight: 500;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link:hover {
    color: hsl(var(--foreground));
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--card-border));
    border-radius: var(--radius);
    padding: 0.5rem;
    min-width: 12rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 0.5rem 0.75rem;
    color: hsl(var(--foreground));
    border-radius: calc(var(--radius) - 4px);
    transition: background-color 0.2s;
}

.dropdown-link:hover {
    background: hsl(var(--muted));
}

.nav-mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: hsl(var(--foreground));
    font-size: 1.25rem;
    cursor: pointer;
}

.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--card-border));
    box-shadow: var(--shadow-lg);
}

.mobile-menu-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-link {
    color: hsl(var(--foreground));
    padding: 0.5rem 0;
    border-bottom: 1px solid hsl(var(--card-border) / 0.5);
}

.mobile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    line-height: 1;
}

.btn-primary {
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    box-shadow: var(--shadow-glow);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, hsl(var(--primary-glow) / 0.4), transparent);
    transition: left 0.5s;
}

.btn-primary:hover {
    background: var(--gradient-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-intense), var(--shadow-lg);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border-color: hsl(var(--border));
}

.btn-secondary:hover {
    background: hsl(var(--muted));
}

.btn-ghost {
    background: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover {
    background: hsl(var(--muted));
}

/* Enhanced Glass Card Component */
.glass-card {
    background: hsl(var(--card) / 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid hsl(var(--card-border) / 0.4);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    overflow: hidden;
    position: relative;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, hsl(var(--primary) / 0.3), transparent);
    pointer-events: none;
}

.glass-card:hover {
    border-color: hsl(var(--primary) / 0.4);
    box-shadow: var(--shadow-lg), var(--shadow-glow-intense);
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gradient Text */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    padding: 2rem 1rem;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient-hero);
    z-index: -3;
}

.hero-orb-1, .hero-orb-2 {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    z-index: -2;
    animation: float 6s ease-in-out infinite;
}

.hero-orb-1 {
    width: 20rem;
    height: 20rem;
    background: var(--gradient-primary);
    top: 10%;
    right: 10%;
    animation-delay: 0s;
}

.hero-orb-2 {
    width: 15rem;
    height: 15rem;
    background: var(--gradient-accent);
    bottom: 10%;
    left: 10%;
    animation-delay: 3s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 48rem;
}

.hero h1 {
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero p {
    font-size: 1.25rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 2rem;
}

/* Section Badge */
.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: hsl(var(--card) / 0.5);
    border: 1px solid hsl(var(--card-border) / 0.5);
    border-radius: 9999px;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1rem;
}

.pulse-dot {
    width: 0.5rem;
    height: 0.5rem;
    background: hsl(var(--success));
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* IP Section */
.ip-section {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    margin-bottom: 1rem;
}

/* Form Elements */
.input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: hsl(var(--input));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    transition: all 0.2s;
}

.input:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input::placeholder {
    color: hsl(var(--muted-foreground));
}

/* Lookup Form */
.lookup-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.lookup-input {
    position: relative;
    flex: 1;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

.lookup-input .input {
    padding-left: 2.5rem;
}

/* Results */
.result {
    padding: 1.5rem;
    border-radius: var(--radius);
    background: var(--gradient-card);
    border: 1px solid hsl(var(--card-border) / 0.5);
}

/* Loading */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid hsl(var(--muted));
    border-radius: 50%;
    border-top-color: hsl(var(--primary));
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Map Container */
.map-container {
    position: relative;
    height: 24rem;
    border-radius: calc(var(--radius) - 4px);
    overflow: hidden;
    background: var(--gradient-card);
}

.map-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, hsl(var(--muted)) 0%, hsl(var(--card)) 100%);
}

.map-marker {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: hsl(var(--card) / 0.9);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
}

.map-marker-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.map-controls {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.map-control {
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: hsl(var(--card) / 0.9);
    backdrop-filter: blur(12px);
    font-size: 1rem;
    font-weight: 700;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2rem;
    text-align: center;
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
}

.feature-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: var(--shadow-glow);
}

/* Footer */
.footer {
    background: hsl(var(--card));
    border-top: 1px solid hsl(var(--card-border) / 0.5);
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section {
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 1rem;
}

.footer ul {
    list-style: none;
}

.footer ul li {
    margin-bottom: 0.5rem;
}

.footer ul li a {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer ul li a:hover {
    color: hsl(var(--foreground));
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 2rem;
    border-top: 1px solid hsl(var(--card-border) / 0.5);
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cookie-notice {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}

/* Copy Button */
.copy-btn {
    opacity: 0;
    transition: opacity 0.2s;
}

.copy-btn.copied {
    animation: copy-pulse 0.6s ease-out;
}

@keyframes copy-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Error and Success Messages */
.error-message {
    padding: 1rem;
    background: hsl(var(--destructive) / 0.1);
    border: 1px solid hsl(var(--destructive) / 0.3);
    border-radius: calc(var(--radius) - 2px);
    color: hsl(var(--destructive));
    font-size: 0.875rem;
}

.success-message {
    padding: 1rem;
    background: hsl(var(--success) / 0.1);
    border: 1px solid hsl(var(--success) / 0.3);
    border-radius: calc(var(--radius) - 2px);
    color: hsl(var(--success));
    font-size: 0.875rem;
}

/* IP Info List Styles */
.ip-info-list {
    list-style: none;
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
}

.ip-info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(145deg, hsl(var(--card)) 0%, hsl(240 12% 12%) 100%);
    border: 1px solid hsl(var(--card-border) / 0.3);
    border-radius: calc(var(--radius) - 4px);
    transition: all 0.2s ease;
    position: relative;
}

.ip-info-item:hover {
    border-color: hsl(var(--primary) / 0.3);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.ip-info-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: hsl(var(--primary) / 0.1);
    flex-shrink: 0;
}

.ip-info-icon {
    color: hsl(var(--primary));
    font-size: 0.875rem;
}

.ip-info-label {
    font-weight: 600;
    color: hsl(var(--foreground));
    min-width: 6rem;
    flex-shrink: 0;
}

.ip-info-value {
    flex: 1;
    color: hsl(var(--muted-foreground));
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    word-break: break-all;
}

.copy-btn {
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 6px);
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
    opacity: 0;
    visibility: hidden;
}

.copy-btn:hover {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    border-color: hsl(var(--primary) / 0.5);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-tooltip {
    position: absolute;
    top: -2rem;
    left: 50%;
    transform: translateX(-50%);
    background: hsl(var(--card));
    color: hsl(var(--success));
    padding: 0.25rem 0.5rem;
    border-radius: calc(var(--radius) - 6px);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    border: 1px solid hsl(var(--success) / 0.3);
    box-shadow: var(--shadow-sm);
}

.copy-btn.copied .copy-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Reveal copy button on hover/focus for better UX */
.ip-info-item:hover .copy-btn,
.ip-info-item:focus-within .copy-btn {
    opacity: 1;
    visibility: visible;
}

/* Icon inside copy button */
.copy-btn i {
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-center {
        display: none;
    }
    
    .nav-mobile-toggle {
        display: block;
    }
    
    .mobile-menu.active {
        display: block;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .lookup-form {
        flex-direction: column;
    }
    
    .stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
    
    .container {
        padding: 0 1rem;
    }
}