/* ==========================================================================
   1. Design System & Variables (ShadCN Inspired)
   ========================================================================== */
   :root {
    --background: 240 10% 98.5%;
    --foreground: 222.2 84% 4.9%;

    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
 
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
 
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;

    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;

    --accent: 210 40% 96.1%;

    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
 
    --radius: 0.5rem;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.07), 0 1px 2px -1px rgb(0 0 0 / 0.07);
}

[data-theme="dark"] {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;

    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;

    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;
 
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;

    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;

    --accent: 217.2 32.6% 17.5%;

    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;

    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.2), 0 1px 2px -1px rgb(0 0 0 / 0.2);
}

/* ==========================================================================
   2. Base & Layout
   ========================================================================== */
* {
    box-sizing: border-box;
    border-width: 0;
    border-style: solid;
    border-color: hsl(var(--border));
}
html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    transition: background-color 0.2s, color 0.2s;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto 1rem auto;
    font-weight: 500;
}
.logo {
    font-size: 1.125rem;
}

/* ==========================================================================
   3. Card Component
   ========================================================================== */
.card {
    border-radius: calc(var(--radius) + 2px);
    border-width: 1px;
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    box-shadow: var(--shadow);
    padding: 1.5rem;
}
.card-header {
    margin-bottom: 1.5rem;
}
.card-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    border: none;
    padding: 0;
}
.card-description {
    margin: 0;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* ==========================================================================
   4. Form Elements & Buttons
   ========================================================================== */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
}
.label-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
label {
    font-size: 0.875rem;
    font-weight: 500;
}
.input {
    display: flex;
    height: 2.5rem;
    width: 100%;
    border-radius: var(--radius);
    border-width: 1px;
    border-color: hsl(var(--input));
    background-color: transparent;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    outline: none;
    transition: all 0.2s;
}
.input:focus {
    box-shadow: 0 0 0 2px hsl(var(--ring));
}
textarea.input {
    min-height: 80px;
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.5rem;
    padding: 0 1rem;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    margin: 0;
}
.btn:focus {
    box-shadow: 0 0 0 2px hsl(var(--ring));
}
.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}
.btn-primary:hover {
    opacity: 0.9;
}
.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border: 1px solid hsl(var(--input));
}
.btn-secondary:hover {
    background-color: hsl(var(--accent));
}
.btn-ghost {
    background-color: transparent;
}
.btn-ghost:hover {
    background-color: hsl(var(--accent));
}
.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
}
.w-full {
    width: 100%;
}
.sun-icon, .moon-icon { display: none; }
body:not([data-theme="dark"]) .moon-icon { display: block; }
[data-theme="dark"] .sun-icon { display: block; }

.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
select.input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.25rem;
}
.select-chevron {
    position: absolute;
    right: 0.75rem;
    height: 1rem;
    width: 1rem;
    pointer-events: none;
    color: hsl(var(--muted-foreground));
}

/* ==========================================================================
   5. Other Components (Badges, Tables, etc.)
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
}
span.badge:empty {
    display: none;
}
.results-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.results-header h2 {
    margin: 0;
}
.button-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
}
table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
}
th {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    font-weight: 500;
}
td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-top: 1px solid hsl(var(--border));
    word-break: break-word;
    max-width: 300px;
}
tbody tr:first-child td {
    border-top: none;
}

.feature-list {
    margin: 0;
    padding-left: 1.25rem;
    color: hsl(var(--muted-foreground));
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.loader {
    border: 4px solid hsl(var(--secondary));
    border-top: 4px solid hsl(var(--primary));
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.status-error { color: #e5484d; }
[data-theme="dark"] .status-error { color: #ff5c5c; }