:root {
    --bg-base: #0F172A;
    --bg-surface: #1E293B;
    --bg-card: #334155;
    
    --primary: #F59E0B;
    --primary-light: rgba(245, 158, 11, 0.2);
    --primary-hover: #D97706;
    
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    
    --border: #334155;
    
    /* Status Colors */
    --cat-100: #3B82F6; /* Blue */
    --cat-200: #10B981; /* Green */
    --cat-300: #8B5CF6; /* Purple */
    --cat-400: #EF4444; /* Red */
    --cat-500: #F97316; /* Orange */
}

/* Light Theme Variables */
:root[data-theme="light"] {
    --bg-base: #F1F5F9;
    --bg-surface: #FFFFFF;
    --bg-card: #E2E8F0;
    
    --text-main: #0F172A;
    --text-muted: #64748B;
    
    --border: #CBD5E1;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header i {
    color: var(--primary);
    width: 24px;
    height: 24px;
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 800;
    flex: 1;
    letter-spacing: -0.02em;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background-color: var(--bg-card);
    color: var(--text-main);
}

/* Search */
.search-container {
    padding: 1rem 1.5rem;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.search-container i {
    position: absolute;
    left: 2.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

#search-input {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid transparent;
    color: var(--text-main);
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

#search-input:focus {
    border-color: var(--primary);
}

.keyboard-hint {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    justify-content: flex-end;
}
.keyboard-hint span {
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-family: 'Fira Code', monospace;
}

/* Nav List */
.category-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.cat-group {
    margin-bottom: 1.5rem;
}

.cat-title {
    padding: 0 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.nav-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    align-items: center;
    transition: background-color 0.15s;
    user-select: none;
}

.nav-item:hover {
    background-color: rgba(255,255,255,0.03);
}

:root[data-theme="light"] .nav-item:hover {
    background-color: rgba(0,0,0,0.03);
}

.nav-item.active {
    background-color: var(--primary-light);
    border-right: 3px solid var(--primary);
}

.nav-code {
    font-family: 'Fira Code', monospace;
    font-weight: 600;
    font-size: 0.9rem;
}

.cat-1 .nav-code { color: var(--cat-100); }
.cat-2 .nav-code { color: var(--cat-200); }
.cat-3 .nav-code { color: var(--cat-300); }
.cat-4 .nav-code { color: var(--cat-400); }
.cat-5 .nav-code { color: var(--cat-500); }

.nav-phrase {
    font-size: 0.9rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content */
.content {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-base);
    position: relative;
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
}

.mobile-header {
    display: none;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mobile-header h2 {
    font-weight: 800;
    font-size: 1.5rem;
}

.details-container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.empty-state .large-icon {
    width: 64px; height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Detail View */
.status-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.status-title-group {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.huge-code {
    font-family: 'Fira Code', monospace;
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1;
}

.title-phrase {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid;
    align-self: center;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2.5rem;
}

/* Text Specs */
.spec-section {
    margin-bottom: 2.5rem;
}

.spec-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spec-section h3 i {
    width: 16px; height: 16px;
}

.spec-section p {
    font-size: 1.1rem;
    color: var(--text-main);
    line-height: 1.7;
}

.use-case-box {
    background-color: var(--bg-surface);
    border-left: 4px solid var(--primary);
    padding: 1.25rem;
    border-radius: 0 8px 8px 0;
    font-size: 1.05rem;
    color: var(--text-main);
    margin-top: 1rem;
}

.code-block {
    position: relative;
    background-color: #000;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-top: 1rem;
    overflow: hidden;
}

.code-block pre {
    padding: 1.5rem;
    color: #A78BFA;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

:root[data-theme="light"] .code-block pre {
     background-color: var(--bg-surface);
     color: #4C1D95;
}

.btn-copy {
    position: absolute;
    top: 0.5rem; right: 0.5rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-muted);
    padding: 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-copy:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.btn-small-rect {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-small-rect:hover {
    background-color: var(--bg-card);
}

/* Meme Image */
.meme-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 2rem;
}

.meme-wrapper {
    width: 100%;
    aspect-ratio: 4/3;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meme-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.loading-spinner {
    position: absolute;
    width: 30px; height: 30px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.meme-credit {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}
.meme-credit a {
    color: var(--primary);
    text-decoration: none;
}
.meme-credit a:hover { text-decoration: underline; }

/* Scrollbars */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-surface);
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
    .meme-container {
        position: static;
        max-width: 500px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .content {
        padding: 1.5rem;
    }
    .mobile-header {
        display: flex;
    }
    .status-title-group {
        flex-direction: column;
        gap: 0;
    }
}
