/* ===== Variables ===== */

/* Dark Theme (Default) */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-input: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-success: #22c55e;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --bg-input: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-primary: #2563eb;
    --accent-secondary: #3b82f6;
    --accent-success: #16a34a;
    --accent-warning: #d97706;
    --accent-error: #dc2626;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navbar */
.navbar {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-link:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Language Selector */
.lang-selector {
    position: relative;
}

.lang-btn, .theme-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.lang-btn:hover, .theme-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.lang-dropdown, .theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.lang-dropdown.show, .theme-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option, .theme-option {
    display: block;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.15s;
    border-bottom: 1px solid var(--border-color);
}

.lang-option:last-child, .theme-option:last-child {
    border-bottom: none;
}

.lang-option:hover, .theme-option:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.lang-option.active, .theme-option.active {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Theme Selector */
.theme-selector {
    position: relative;
}

/* Main */
.main {
    min-height: calc(100vh - 64px - 60px);
}

/* Hero */
.hero {
    padding: 80px 0 60px;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Tools Grid */
.tools-grid {
    padding: 40px 0 80px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.tool-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all 0.3s;
    position: relative;
}

.tool-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.tool-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.tool-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.tool-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.tool-arrow {
    position: absolute;
    bottom: 28px;
    right: 28px;
    color: var(--accent-primary);
    font-size: 1.25rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s;
}

.tool-card:hover .tool-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Features */
.features {
    padding: 60px 0 80px;
    background-color: var(--bg-secondary);
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 48px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 32px;
}

.feature {
    text-align: center;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.feature h3 {
    font-size: 1.125rem;
    margin-bottom: 8px;
}

.feature p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Tool Page */
.tool-page {
    padding: 40px 0;
}

.tool-header {
    text-align: center;
    margin-bottom: 40px;
}

.tool-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.tool-header p {
    color: var(--text-secondary);
}

.tool-workspace {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 32px;
}

/* Input/Output Sections */
.input-section,
.output-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

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

.actions {
    display: flex;
    gap: 8px;
}

.code-input,
.code-output {
    width: 100%;
    min-height: 200px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
    resize: vertical;
    transition: border-color 0.2s, background-color 0.3s;
}

.code-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.code-output {
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-secondary);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-large {
    padding: 12px 24px;
    font-size: 1rem;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px;
    background-color: var(--bg-input);
    border-radius: var(--radius-md);
}

.options {
    display: flex;
    gap: 24px;
    flex: 1;
}

.option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

.option select {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Status */
.status {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    display: none;
}

.status.success {
    display: block;
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--accent-success);
    color: var(--accent-success);
}

.status.error {
    display: block;
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--accent-error);
    color: var(--accent-error);
}

/* URL Input */
.url-input-section,
.dns-input-section {
    margin-bottom: 32px;
}

.input-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.url-input {
    flex: 1;
    min-width: 280px;
    padding: 12px 16px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.url-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.record-select {
    padding: 12px 16px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
}

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

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Results */
.results {
    animation: fadeIn 0.3s ease;
}

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

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.metric-card {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.metric-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.metric-sublabel {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.resources-section,
.recommendations-section {
    margin-top: 24px;
    padding: 24px;
    background-color: var(--bg-input);
    border-radius: var(--radius-md);
}

.resources-section h3,
.recommendations-section h3 {
    margin-bottom: 16px;
    font-size: 1rem;
}

.resources-grid {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.resource-count {
    font-weight: 700;
    font-size: 1.125rem;
}

.resource-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.recommendations-section ul {
    list-style: none;
}

.recommendations-section li {
    padding: 8px 0;
    color: var(--text-secondary);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 24px;
    padding: 16px;
    background-color: var(--bg-input);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    color: var(--text-secondary);
}

/* DNS Table */
.records-table {
    width: 100%;
    border-collapse: collapse;
}

.records-table th,
.records-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.records-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}

.records-table td {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* Divider */
.divider {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: var(--border-color);
}

.divider::before { left: 0; }
.divider::after { right: 0; }

/* File Info */
.file-info {
    margin-top: 16px;
    padding: 16px;
    background-color: var(--bg-input);
    border-radius: var(--radius-md);
}

.file-info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.file-info-item:last-child {
    border-bottom: none;
}

/* Footer */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* DNS Record Types */
.record-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-a { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.type-aaaa { background-color: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.type-mx { background-color: rgba(34, 197, 94, 0.2); color: #4ade80; }
.type-txt { background-color: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.type-ns { background-color: rgba(239, 68, 68, 0.2); color: #f87171; }
.type-cname { background-color: rgba(236, 72, 153, 0.2); color: #f472b6; }
.type-soa { background-color: rgba(107, 114, 128, 0.2); color: #9ca3af; }

/* XML Output */
.code-output.xml {
    color: #a5d6ff;
}

[data-theme="light"] .code-output.xml {
    color: #0066cc;
}

/* Ad Containers */
.ad-container {
    margin: 24px 0;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px dashed var(--border-color);
}

.ad-container ins.adsbygoogle {
    display: block;
    margin: 0 auto;
}

/* Responsive ad sizing */
.ad-header {
    min-height: 90px;
}

.ad-content {
    min-height: 250px;
}

.ad-sidebar {
    min-height: 250px;
}

.ad-multiplex {
    min-height: 300px;
}

/* Hide unfilled ads to prevent layout shift */
.ad-container ins.adsbygoogle[data-ad-status="unfilled"] {
    display: none !important;
}

/* Ad label */
.ad-container::before {
    content: "Advertisement";
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .nav-links {
        display: none;
    }

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

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .options {
        flex-direction: column;
        gap: 12px;
    }

    .input-group {
        flex-direction: column;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-right {
        gap: 8px;
    }
}
