/* TERMINAL THEME - ZERO CURVES, PURE FUNCTION */
:root {
    --bg: #000000;
    --surface: #0a0a0a;
    --surface-alt: #111111;
    --text: #00ff41;
    --text-dim: #00aa29;
    --text-secondary: #888888;
    --accent: #00ff41;
    --accent-alt: #ffb000;
    --border: #00ff41;
    --border-dim: #004411;
    --error: #ff0000;
    --warning: #ffb000;
    
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

.light-theme {
    --bg: #f0f0f0;
    --surface: #ffffff;
    --surface-alt: #e8e8e8;
    --text: #1a1a1a;
    --text-dim: #444444;
    --text-secondary: #666666;
    --accent: #000000;
    --accent-alt: #ff0000;
    --border: #000000;
    --border-dim: #888888;
    --error: #cc0000;
    --warning: #ff6600;
}

/* BASE RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-mono);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

/* SCANLINE EFFECT */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03),
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 9999;
}

/* THEME TOGGLE */
.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--accent);
    color: var(--bg);
    box-shadow: 0 0 10px var(--accent);
}

/* HEADER */
header {
    text-align: center;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 1000px;
}

.ascii-logo {
    font-size: 1.33rem;
    line-height: 1;
    color: var(--accent);
    white-space: pre;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 1rem;
    /*text-shadow: 0 0 5px var(--accent);*/
    user-select: none;
}

@media (max-width: 640px) {
    .ascii-logo {
        font-size: 0.25rem;
    }
}

.tagline {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    letter-spacing: 0.2em;
}

.status-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-dim);
    border-bottom: 1px solid var(--border-dim);
    padding: 0.5rem;
    margin-top: 1rem;
}

.status-item::before {
    content: "◉ ";
    color: var(--accent);
}

/* CONTROLS */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 800px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 250px;
}

.input-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

#searchInput, #categoryFilter {
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-dim);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

#searchInput:focus, #categoryFilter:focus {
    border-color: var(--accent);
    box-shadow: inset 0 0 5px var(--accent);
}

#searchInput::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

/* PRODUCT GRID */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0;
    width: 100%;
    max-width: 1200px;
    margin-bottom: 3rem;
    border: 1px solid var(--border-dim);
}

/* CARD - BRUTALIST TERMINAL STYLE */
.card {
    background: var(--surface);
    border: 1px solid var(--border-dim);
    margin: -1px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s ease;
}

.card:hover {
    background: var(--surface-alt);
    border-color: var(--accent);
    z-index: 10;
}

.card:hover .card-title {
    color: var(--accent);
    text-shadow: 0 0 5px var(--accent);
}

.card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border-dim);
    filter: grayscale(30%) contrast(1.1);
}

.card-content {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 0.5rem;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
}

/* Show more/less */
.card-description .full-text {
    display: none;
}

.card-description.expanded .full-text {
    display: inline;
}

.card-description.expanded .short-text {
    display: none;
}

.show-more-btn {
    background: transparent;
    border: 1px solid var(--border-dim);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.3rem 0.8rem;
    margin-bottom: 1rem;
    align-self: flex-start;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s ease;
}

.show-more-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 5px var(--accent);
}

.card-link {
    display: block;
    background: transparent;
    color: var(--accent);
    text-decoration: none;
    padding: 0.6rem 1rem;
    border: 1px solid var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: auto;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.card-link::before {
    content: "> ";
}

.card-link:hover {
    background: var(--accent);
    color: var(--bg);
    box-shadow: 0 0 15px var(--accent);
}

.card-link.invalid {
    border-color: var(--error);
    color: var(--error);
    cursor: not-allowed;
}

.card-link.invalid::before {
    content: "X ";
}

/* ACCESSIBILITY */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 10px var(--accent);
}

/* STATES */
.loading, .error, .no-results {
    color: var(--text-secondary);
    padding: 2rem;
    text-align: center;
    font-size: 0.9rem;
    grid-column: 1 / -1;
    border: 1px solid var(--border-dim);
}

.error {
    color: var(--error);
    border-color: var(--error);
}

.error::before {
    content: "[ERROR] ";
}

.no-results::before {
    content: "[EMPTY_SET] ";
}

/* FOOTER - HACKER TERMINAL STYLE */
footer {
    margin-top: auto;
    text-align: center;
    width: 100%;
    max-width: 600px;
    padding: 2rem 0;
}

.footer-line {
    color: var(--border-dim);
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    letter-spacing: 0;
}

.footer-text {
    color: var(--text-dim);
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
    font-family: var(--font-mono);
}

.bracket {
    color: var(--accent);
    opacity: 0.7;
}

.static {
    color: var(--text-secondary);
}

/* Morphing word with glitch effect */
.morph-text {
    color: var(--accent);
    font-weight: 700;
    display: inline-block;
    min-width: 40px;
    text-align: center;
    position: relative;
    text-shadow: 0 0 5px var(--accent);
    transition: all 0.1s ease;
}

/* Glitch animation classes */
.morph-text.glitch {
    animation: glitch 0.2s ease;
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

.morph-text.scramble {
    color: var(--accent-alt);
    text-shadow: 0 0 5px var(--accent-alt);
}

/* Cursor blink */
.cursor-blink {
    color: var(--text-secondary);
    font-size: 0.75rem;
    opacity: 0.6;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Binary rain effect behind footer */
footer {
    position: relative;
}

footer::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.03) 2px,
        rgba(0, 255, 65, 0.03) 4px
    );
    pointer-events: none;
}

/* RESPONSIVE */
@media (max-width: 640px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .ascii-logo {
        font-size: 0.2rem;
    }
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-dim);
    border: 1px solid var(--border);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* SELECTION */
::selection {
    background: var(--accent);
    color: var(--bg);
}
