/* =========================================
   Variables & Reset
========================================= */
:root {
    /* Paleta base Oscura (Default) */
    --bg-app: #0F1115;
    --bg-surface: #171A21;
    --bg-surface-hover: #1e222b;
    --bg-glass: rgba(23, 26, 33, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 255, 255, 0.15);
    
    /* Texto */
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    
    /* Acentos */
    --accent-blue: #3B82F6;
    --accent-purple: #8B5CF6;
    --accent-mint: #10B981;
    --accent-danger: #EF4444;
    
    /* UI */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
    
    /* Transiciones */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tema Claro */
body.light-theme {
    --bg-app: #F9FAFB;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #F3F4F6;
    --bg-glass: rgba(255, 255, 255, 0.8);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(0, 0, 0, 0.15);
    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-muted: #9CA3AF;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* =========================================
   Layout Principal
========================================= */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* =========================================
   Sidebar
========================================= */
.sidebar {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal);
    z-index: 40;
}

.sidebar-header {
    height: 70px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid transparent;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.logo i { color: var(--accent-purple); font-size: 1.4rem; }

.close-sidebar-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-nav {
    padding: 24px 16px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.nav-section { display: flex; flex-direction: column; gap: 4px; }
.mt-auto { margin-top: auto; padding-top: 24px; border-top: 1px solid var(--border-color); }

.nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    padding-left: 12px;
}

.nav-item, .nav-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.nav-item:hover, .nav-action:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
}

.nav-item i { font-size: 1.1rem; }

/* =========================================
   Main Content & Header
========================================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.top-header {
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 30;
}

.menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 16px;
    height: 40px;
    width: 350px;
    transition: border-color var(--transition-fast);
    cursor: text;
}

.search-bar:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.search-bar i { color: var(--text-muted); font-size: 1.1rem; }
.search-bar input {
    background: none;
    border: none;
    color: var(--text-primary);
    margin-left: 12px;
    width: 100%;
    outline: none;
    font-size: 0.9rem;
}

.keyboard-shortcut {
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover { color: var(--text-primary); border-color: var(--border-highlight); }

.primary-btn {
    background: linear-gradient(135deg, var(--accent-purple), #6d28d9);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.secondary-btn {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.secondary-btn:hover { background: var(--bg-surface-hover); }

.avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-surface);
}

/* =========================================
   Dashboard Stats
========================================= */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 32px 32px 0 32px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform var(--transition-fast);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-highlight); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info p { color: var(--text-muted); font-size: 0.8rem; font-weight: 500; text-transform: uppercase; }
.stat-info h3 { color: var(--text-primary); font-size: 1.5rem; font-weight: 700; margin-top: 2px; }

/* =========================================
   Content Area & Grid
========================================= */
.content-area { padding: 32px; }

.section-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-header h2 { font-size: 1.5rem; font-weight: 600; color: var(--text-primary); }

.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* =========================================
   Prompt Cards
========================================= */
.prompt-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.prompt-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-lg);
}

.card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }

.card-category {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.05em;
    background: rgba(255,255,255,0.05);
}

.card-actions { display: flex; gap: 8px; opacity: 0; transition: opacity var(--transition-fast); }
.prompt-card:hover .card-actions { opacity: 1; }

.card-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color var(--transition-fast);
}
.card-action-btn:hover { color: var(--text-primary); }
.card-action-btn.fav-btn.active { color: #F59E0B; } /* Amber */

.card-title { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; line-height: 1.3;}
.card-desc { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 16px; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag { font-size: 0.7rem; color: var(--text-secondary); background: var(--bg-app); padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border-color); }

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.card-date { font-size: 0.75rem; color: var(--text-muted); }

.copy-btn {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.2);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}
.copy-btn:hover { background: var(--accent-purple); color: white; }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; }
.empty-icon { font-size: 4rem; color: var(--border-color); margin-bottom: 16px; }
.empty-state h3 { color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); max-width: 300px; }
.hidden { display: none !important; }
.mt-4 { margin-top: 16px; }

/* =========================================
   Modals
========================================= */
.modal-overlay, .cmd-palette-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 8vh;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    animation: slideUp 0.3s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.25rem; font-weight: 600; }

#promptForm { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 100px; gap: 16px; }

.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }

input[type="text"], textarea {
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

input[type="text"]:focus, textarea:focus { border-color: var(--accent-purple); }
textarea { resize: vertical; min-height: 120px; font-family: 'Inter', monospace; }

.color-picker { width: 100%; height: 42px; padding: 2px; background: var(--bg-app); border: 1px solid var(--border-color); border-radius: var(--radius-sm); cursor: pointer; }

.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* Command Palette */
.cmd-palette-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 550px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    overflow: hidden;
    transform: scale(0.95);
    animation: scaleIn 0.2s forwards;
}

.cmd-header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border-color); }
.cmd-header i { font-size: 1.2rem; color: var(--text-secondary); }
.cmd-header input { flex: 1; background: none; border: none; color: var(--text-primary); font-size: 1.1rem; outline: none; margin-left: 12px; }
.esc-hint { font-size: 0.7rem; color: var(--text-muted); background: var(--bg-app); padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border-color); }

.cmd-results { max-height: 350px; overflow-y: auto; padding: 8px; }
.cmd-item { padding: 12px 16px; border-radius: var(--radius-sm); display: flex; justify-content: space-between; cursor: pointer; color: var(--text-secondary); transition: all 0.1s; }
.cmd-item:hover, .cmd-item.active { background: var(--bg-surface-hover); color: var(--text-primary); }
.cmd-item-title { font-weight: 500; }
.cmd-item-cat { font-size: 0.75rem; background: var(--bg-app); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border-color); }

/* =========================================
   Toasts & Animations
========================================= */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-highlight);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideLeft 0.3s forwards, fadeOut 0.3s forwards 2.7s;
}
.toast i { color: var(--accent-mint); font-size: 1.2rem; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideLeft { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }

/* =========================================
   Responsive
========================================= */
@media (max-width: 768px) {
    .sidebar { position: fixed; height: 100vh; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .close-sidebar-btn { display: block; }
    .menu-btn { display: block; margin-right: 16px; }
    .search-bar { display: none; } /* En móvil se usa el botón buscar o menú */
    .top-header { padding: 0 16px; }
    .content-area { padding: 16px; }
    .dashboard-stats { padding: 16px 16px 0 16px; }
    .prompts-grid { grid-template-columns: 1fr; }
}