:root {
    /* Palette */
    --bg: #050505;
    --surface: #121212;
    --text-primary: #D1D1D1;
    --text-secondary: #888888;
    --accent: #90a8ed;
    --border: #333333;
    
    /* Semantic */
    --error-bg: rgba(139, 0, 0, 0.1);
    --error-text: #FF4444;
    --success-bg: rgba(45, 54, 43, 0.2);
    --success-text: #4CAF50;

    /* Geometry */
    --radius-base: 10px;
    --radius-large: 12px;
    --radius-pill: 999px;
    
    /* Typography */
    --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, monospace;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-mono);
    margin: 0;
    padding: 0; /* Changed to 0 so the top bar is flush */
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
a {
  text-decoration: none;
}

/* CREDIT BAR */
.credit-bar {
    width: 100%;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    text-align: center;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 6px 0;
    flex-shrink: 0;
    z-index: 100;
}
.credit-bar a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    transition: opacity 0.2s;
}
.credit-bar a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Ensure app-layout fills the rest of the screen */
.app-layout {
    display: flex;
    flex-grow: 1;
}


/* Typography Hierarchy */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.page-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--olive);
}
.sub-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--olive);
}

/* API Label */
.api-label {
    height: 36px;
    padding: 0 12px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    letter-spacing: normal;
    text-transform: none;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 50%;
    left: 0%;
    transform: translateX(-50%);
    background-color: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(85, 107, 47, 0.2);
}
[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    bottom: 120%;
}


/* Layout System */
.workbench {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
@media (min-width: 900px) {
    .workbench {
        grid-template-columns: 1fr 2fr;
    }
}

/* Cards & Panels */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    overflow: visible;
}
.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-body {
    padding: 24px;
}

/* Inputs & Forms */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}
input, select {
    width: 100%;
    height: 44px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-base);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    padding: 0 12px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    outline: none;
}
input:focus, select:focus {
    border-color: var(--accent);
    /* Focus Ring */
    box-shadow: 0 0 0 3px rgba(255, 176, 0, 0.2); 
}

/* Dropdown specific */
select {
    appearance: none; /* remove default arrow */
    cursor: pointer;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23888888" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position-x: calc(100% - 10px);
    background-position-y: 50%;
}
select option {
    background-color: var(--surface);
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* Buttons */
button {
    font-family: var(--font-mono);
    border-radius: var(--radius-base);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-primary {
    height: 44px;
	align-self: self-end;
    width: 60%;
    background-color: var(--accent);
    color: var(--bg);
    border: 1px solid var(--accent);
    margin-top: 8px;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:focus { box-shadow: 0 0 0 3px rgba(255, 176, 0, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline {
    height: 36px;
    padding: 0 16px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
}
.btn-outline:hover { background: rgba(255,255,255,0.05); }

.btn-ghost {
    height: 36px;
    padding: 0 12px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
}
.btn-ghost:hover { color: var(--text-primary); }
.btn-ghost.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-base);
}

/* Empty State / Dropzone */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-large);
    background: rgba(255, 255, 255, 0.02);
}
.muted-icon {
    color: var(--border);
    margin-bottom: 16px;
}
.empty-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}
.empty-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Data Output Table */
.data-table {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-base);
    overflow: hidden;
}
.data-row {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.data-row:last-child { border-bottom: none; }
.data-key {
    width: 30%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.02);
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
}
.data-value {
    width: 70%;
    padding: 12px 16px;
    font-size: 14px;
    word-break: break-all;
}

/* Utilities */
.hidden { display: none !important; }
.badge {
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 20px;
    font-weight: 500;
    text-transform: uppercase;
    border: 1px solid transparent;
}
.badge.success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: rgba(76, 175, 80, 0.3);
}
.badge.error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: rgba(255, 68, 68, 0.3);
}

/* --- APP SHELL LAYOUT --- */
.app-layout {
    display: flex;
    height: 100%;
}

/* SIDEBAR */
.sidebar {
    width: 280px;
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
}
.sidebar-logo {
    font-size: 20px;
    margin: 0 12px 14px 12px;
    color: var(--text-primary);
    line-height: 1.2;
}
.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}
.nav-link {
    display: block;
    padding: 16px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}
.nav-link:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
}
.nav-link.active {
    background: #90a7ed22;
    color: var(--accent);
    border-left-color: var(--accent);
}
.nav-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}
.nav-desc {
    font-size: 11px;
    opacity: 0.8;
}
.sidebar-footer {
    padding: 24px;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}
.sidebar-footer a {
    color: var(--accent);
    text-decoration: underline;
}

/* MAIN WRAPPER */
.main-wrapper {
    flex-grow: 1;
    padding: 32px 48px;
    max-width: 1200px;
}

/* --- QUOTES UI --- */
.quotes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.quote-card {
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius-base);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(255,255,255,0.01);
    transition: transform 0.2s;
}
.quote-card:hover {
    transform: translateY(-2px);
    border-color: var(--text-secondary);
}
.quote-text {
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}
.quote-author {
    font-size: 12px;
    color: var(--accent);
    text-align: right;
    font-weight: 600;
}
/* --- GRID SYSTEMS & GENERIC ITEM CARDS --- */
.grid-layout {
    display: grid;
    gap: 24px;
}
.product-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.youtube-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.item-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-base);
    background: var(--surface);
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
	text-decoration: none;
}
.item-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.item-image-wrapper {
    position: relative;
    width: 100%;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

/* Products specific image */
.product-image {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* YouTube specific image */
.yt-thumbnail {
    aspect-ratio: 16 / 9;
}
.yt-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.yt-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    border: 1px solid rgba(255,255,255,0.2);
	text-decoration: none;
}

.item-details {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
	text-decoration: none;
}

.item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    /* Truncate text to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
	text-decoration: none;
}

.item-meta {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
	text-decoration: none;
}

.item-price {
    margin-top: auto;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}

.yt-channel {
    color: var(--accent);
    text-transform: none;
    font-size: 12px;
}
.yt-stats {
    text-transform: none;
}
/* --- JOKES & TAGS UI --- */
.jokes-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.joke-card {
    justify-content: flex-start;
}
.joke-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tag {
    font-size: 10px;
    text-transform: uppercase;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    background: rgba(255,255,255,0.03);
}
.tag.tag-warn {
    border-color: rgba(255, 68, 68, 0.4);
    color: var(--error-text);
    background: var(--error-bg);
}


/* --- DOSSIER (CATS) UI --- */
.dossier-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
@media (min-width: 768px) {
    .dossier-layout {
        grid-template-columns: 350px 1fr;
        align-items: start;
    }
}

.dossier-image-wrapper {
    position: relative;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-base);
    overflow: hidden;
    background: #000;
}
@media (min-width: 768px) {
    .dossier-image-wrapper { aspect-ratio: 3 / 4; }
}

.dossier-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.85; /* Slight dimming for the terminal vibe */
    transition: opacity 0.3s;
}
.dossier-image-wrapper:hover img {
    opacity: 1;
}

.dossier-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.8);
    color: var(--accent);
    padding: 8px 16px;
    font-size: 12px;
    border-top: 1px solid var(--border);
    font-weight: 700;
    letter-spacing: 0.1em;
}

.dossier-details {
    display: flex;
    flex-direction: column;
}
/* --- MEALS UI --- */
.meals-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.meal-image {
    aspect-ratio: 4 / 3;
}
.meal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.meal-instruction-snippet {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: auto;
    border-top: 1px dashed var(--border);
    padding-top: 12px;
}

/* --- USERS (ID BADGES) UI --- */
.users-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.id-card {
    display: flex;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-base);
    padding: 16px;
    transition: transform 0.2s, border-color 0.2s;
    align-items: center;
}
.id-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.id-avatar {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg);
}
.id-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(20%); /* Slight desaturation for the tactical look */
}
.id-info {
    display: flex;
    flex-direction: column;
    overflow: hidden; /* prevents text overflow */
}
.id-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.id-username {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.id-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.id-meta div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- MODAL SYSTEM --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px); /* Tactical frosted glass effect */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.modal-content {
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.modal-content .card-body {
    overflow-y: auto;
}

/* --- INTERACTIVE CARDS --- */
.interactive-card {
    cursor: pointer;
    position: relative;
}

.view-prompt {
    margin-top: auto;
    font-size: 10px;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.1em;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

.interactive-card:hover .view-prompt {
    opacity: 1;
    transform: translateX(0);
}