/* CSS Variables - Matching the exact Tailwind theme */
:root {
    --background: 0 0% 100%;
    --background-light: 0 0% 100%;
    --background-dark: 0 0% 0%;
    --background-hover: 5 12% 100%;
    --background-container: 0, 0%, 97%, 0.8;
    --foreground: 240 10% 3.9%;

    --card: 0 0% 100%;
    --card-hover: 0 0% 97%;
    --card-active: 0 0% 94.5%;
    --card-foreground: 240 10% 3.9%;

    --popover: 0 0% 100%;
    --popover-foreground: 240 10% 3.9%;

    --primary: 240 5.9% 10%;
    --primary-foreground: 0 0% 98%;

    --secondary: 240 4.8% 95.9%;
    --secondary-foreground: 240 5.9% 10%;

    --muted: 240 4.8% 95.9%;
    --muted-foreground: 240 3.8% 46.1%;

    --accent: 240 4.8% 95.9%;
    --accent-secondary: 240 4.8% 95.9%;
    --accent-foreground: 240 5.9% 10%;

    --destructive: 0 67.22% 50.59%;
    --destructive-foreground: 0 0% 98%;

    --success: 120 100% 50%;
    --success-foreground: 0 0% 98%;

    --failure: 0 67.22% 50.59%;
    --failure-foreground: 0 0% 98%;

    --border: 240 5.9% 90%;
    --border-hover: 240 5.9% 85%;
    --border-active: 240 5.9% 80%;

    --input: 240 5.9% 90%;
    --input-unread: 240 5.9% 50%;
    --ring: 240 5% 64.9%;

    --text: 0 0% 0%;
    --text-light: 0 0% 100%;
    --text-dark: 0 0% 100%;
    --text-secondary: 0 0% 35%;
    --text-secondary-dark: 0 0% 80%;

    --selection: 212 100% 41%;
    --selection-foreground: 0 0% 98%;

    --radius: 0.5rem;
    --shadow: #00000005;
}

.dark {
    --background: 0 0% 0%;
    --background-hover: 0 0% 7.8%;
    --background-container: 0, 0%, 7.8%, 0.8;
    --foreground: 210 40% 98%;

    --card: 240 10% 3.9%;
    --card-hover: 240 11% 12.5%;
    --card-active: 240 9.5% 19%;
    --card-foreground: 0 0% 98%;

    --popover: 240 10% 3.9%;
    --popover-foreground: 0 0% 98%;

    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;

    --secondary: 0 0% 10%;
    --secondary-foreground: 0 0% 98%;

    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;

    --accent: 240 3.7% 15.9%;
    --accent-secondary: 240 5% 15.9%;
    --accent-foreground: 0 0% 98%;

    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;

    --border: 240 3.7% 15.9%;
    --border-hover: 240 3.7% 20.9%;
    --border-active: 240 3.7% 25.9%;
    --input: 240 3.7% 15.9%;
    --input-unread: 240 3.7% 50%;
    --ring: 240 4.9% 83.9%;
    --text: 0 0% 100%;
    --text-secondary: 0 0% 80%;

    --shadow: #ffffff05;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-color: hsl(var(--border));
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
}

/* Animated Dot Grid Background */
.dot-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px);
    background-size: 25px 25px;
    opacity: 1;
}

.dark .dot-grid {
    background-image: radial-gradient(circle, hsl(var(--muted-foreground) / 0.2) 1px, transparent 1px);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0.5rem 1rem;
    background-color: hsl(var(--background));
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    flex-direction: row;
    align-items: center;
    z-index: 50;
    gap: 0.5rem;
    user-select: none;
}

.header-icon {
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.25rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    background-color: #000;
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
    transition: all 150ms;
}

.header-icon:hover {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

/* Theme Toggle Icons */
.theme-icon {
    width: 1.2rem;
    height: 1.2rem;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
}

.sun-icon {
    rotate: 0deg;
    scale: 1;
}

.dark .sun-icon {
    rotate: -90deg;
    scale: 0;
}

.moon-icon {
    rotate: 90deg;
    scale: 0;
}

.dark .moon-icon {
    rotate: 0deg;
    scale: 1;
}

main {
    position: relative;
    z-index: 1;
}

/* Utility Classes */
.w-full { width: 100%; }
.h-full { height: 100%; }
.h-fit { height: fit-content; }
.grid { display: grid; }
.flex { display: flex; }
.hidden { display: none; }
.inline-flex { display: inline-flex; }
.place-items-center { place-items: center; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.gap-2 { gap: 0.5rem; }
.shrink-0 { flex-shrink: 0; }
.flex-grow { flex-grow: 1; }
.grow { flex-grow: 1; }

/* Spacing */
.p-4 { padding: 1rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-0-5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.pl-2 { padding-left: 0.5rem; }
.pl-3-5 { padding-left: 0.875rem; }
.pr-2 { padding-right: 0.5rem; }
.pr-2-5 { padding-right: 0.625rem; }
.m-0-5 { margin: 0.125rem; }
.mx-1 { margin-left: 0.25rem; margin-right: 0.25rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-0-5 { margin-top: 0.125rem; margin-bottom: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-1-5 { margin-top: 0.375rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-1-5 { margin-right: 0.375rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-0-5 { margin-right: 0.125rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-auto { margin-left: auto; }

/* Width/Height */
.w-3 { width: 0.75rem; }
.h-3 { height: 0.75rem; }
.w-3-5 { width: 0.875rem; }
.h-3-5 { height: 0.875rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.max-w-568 { max-width: 568px; }
.max-w-1200 { max-width: 1200px; }

/* Text */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-md { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.select-none { user-select: none; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.whitespace-nowrap { white-space: nowrap; }
.break-all { word-break: break-all; }
.break-words { word-break: break-word; }
.text-ellipsis { text-overflow: ellipsis; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Colors */
.text-primary { color: hsl(var(--primary)); }
.text-secondary { color: hsl(var(--muted-foreground)); }
.text-destructive { color: hsl(var(--destructive)); }
.border-destructive { border-color: hsl(var(--destructive)); }
.bg-muted\/20 { background-color: hsla(var(--muted), 0.2); }

/* Positioning */
.relative { position: relative; }
.absolute { position: absolute; }
.right-0 { right: 0; }

/* Border */
.border { border: 1px solid hsl(var(--border)); }
.rounded-md { border-radius: calc(var(--radius) - 2px); }
.rounded-l-none { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* Transitions */
.transition { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-all { transition-property: all; }
.duration-300 { transition-duration: 300ms; }
.duration-500 { transition-duration: 500ms; }

/* Hover States */
.hover\:text-primary:hover { color: hsl(var(--primary)); }
.hover\:shadow:hover { box-shadow: 0 1px 3px 0 var(--shadow), 0 1px 2px -1px var(--shadow); }
.hover\:bg-muted\/40:hover { background-color: hsla(var(--muted), 0.4); }
.hover\:border-hover:hover { border-color: hsl(var(--border-hover)); }
.hover\:underline:hover { text-decoration: underline; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.animate-spin { animation: spin 1s linear infinite; }

/* Grid */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

/* Input Styles */
.input {
    display: flex;
    height: 2.5rem;
    width: 100%;
    outline: none;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: hsl(var(--foreground));
    position: relative;
    z-index: 10;
}

.input::placeholder {
    color: hsl(var(--muted-foreground));
}

.input:focus {
    outline: none;
}

.input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
}

.btn:focus-visible {
    outline: none;
}

.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.btn-default {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-default:hover {
    background-color: hsl(var(--primary) / 0.9);
}

.btn-outline {
    border: 1px solid hsl(var(--input));
    background-color: hsla(var(--muted), 0.2);
}

.btn-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-sm {
    height: 2.25rem;
    padding: 0 0.75rem;
}

.btn-icon {
    height: 2.5rem;
    width: 2.5rem;
    padding: 0;
}

.btn-icon-sm {
    height: 2rem;
    width: 2rem;
    padding: 0;
}

/* Card Styles */
.card {
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
}

.card-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.75rem;
}

.card-content {
    padding: 1.5rem;
}

/* History Item */
.history-item {
    font-size: 0.875rem;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
    padding-left: 0.875rem;
    padding-right: 0.625rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    color: hsl(var(--muted-foreground));
    transition: all 300ms;
    background-color: hsla(var(--muted), 0.2);
    text-decoration: none;
}

.history-item:hover {
    background-color: hsla(var(--muted), 0.4);
    color: hsl(var(--primary));
    border-color: hsl(var(--border-hover));
}

.history-item:active {
    transform: scale(0.985);
}

.history-item .trash-icon {
    color: rgba(220, 38, 38, 0.8);
}

/* Scroll Area */
.scroll-area {
    max-height: 400px;
    overflow-y: auto;
}

.scroll-area::-webkit-scrollbar {
    width: 8px;
}

.scroll-area::-webkit-scrollbar-track {
    background: hsl(var(--muted));
    border-radius: 4px;
}

.scroll-area::-webkit-scrollbar-thumb {
    background: hsl(var(--muted-foreground) / 0.3);
    border-radius: 4px;
}

.scroll-area::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / 0.5);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: calc(var(--radius) - 4px);
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid hsl(var(--border));
}

/* Media Queries */
@media (min-width: 768px) {
    .md\:p-6 { padding: 1.5rem; }
    .md\:text-2xl { font-size: 1.5rem; line-height: 2rem; }
    .md\:w-6 { width: 1.5rem; }
    .md\:h-6 { height: 1.5rem; }
    .md\:mr-1-5 { margin-right: 0.375rem; }
    .md\:mt-8 { margin-top: 2rem; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
}

/* Table Styles */
table {
    border-collapse: collapse;
}

td {
    vertical-align: top;
}

pre {
    font-family: 'Courier New', Courier, monospace;
}

.fill-primary {
    fill: hsl(var(--primary));
}

.ml-2 {
    margin-left: 0.5rem;
}

/* Dropdown Container */
.dropdown {
    position: absolute;
    z-index: 50;
    width: 100%;
    margin-top: 0.25rem;
    background-color: hsl(var(--background) / 0.95);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.dropdown.show {
    display: block;
}

/* Dropdown Sections (History vs Quick Suggestions) */
.dropdown-section {
    border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.dropdown-section:last-child {
    border-bottom: none;
}

/* Individual Dropdown Items */
.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s;
    border-bottom: 1px solid hsl(var(--border) / 0.1);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item.selected {
    background-color: hsl(var(--muted) / 0.5);
}

/* Icons in dropdown items */
.dropdown-item-icon {
    width: 0.875rem;
    height: 0.875rem;
    margin-right: 0.5rem;
    color: hsl(var(--muted-foreground) / 0.5);
    flex-shrink: 0;
}

.dropdown-item:hover .dropdown-item-icon {
    color: hsl(var(--muted-foreground) / 0.7);
}

/* Text in dropdown items */
.dropdown-item-text {
    flex-grow: 1;
    font-size: 0.875rem;
    color: hsl(var(--foreground) / 0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-item:hover .dropdown-item-text {
    color: hsl(var(--foreground));
}

/* Badges (DOMAIN, IPv4, etc.) */
.badge.dropdown-badge {
    margin-left: 0.5rem;
    padding: 0 0.375rem;
    font-size: 0.625rem;
    font-weight: normal;
    border: 1px dashed hsl(var(--border));
    border-radius: 0.25rem;
    opacity: 0.4;
    transition: opacity 0.15s;
    background-color: hsl(var(--primary) / 0.2);
    color: hsl(var(--primary));
}

.dropdown-item:hover .badge.dropdown-badge {
    opacity: 0.6;
}

.badge.dropdown-badge.history {
    opacity: 0.6;
    background-color: hsl(var(--muted) / 0.2);
    color: hsl(var(--muted-foreground));
}

/* Datalist Styling */
datalist {
    display: none;
}

/* SVG Fill */
svg {
    flex-shrink: 0;
}

a {
    color: inherit;
    text-decoration: none;
}
