/* ═══════════════════════════════════════════════════════════
   Farmacia Personal — Admin Panel Styles
   ═══════════════════════════════════════════════════════════ */

:root {
    --primary: #1B5E20;
    --primary-light: #4CAF50;
    --primary-dark: #0D3B0F;
    --bg: #F5F5F5;
    --surface: #FFFFFF;
    --text: #212121;
    --text-secondary: #757575;
    --border: #E0E0E0;
    --error: #D32F2F;
    --error-light: #FFCDD2;
    --success: #388E3C;
    --success-light: #C8E6C9;
    --warning: #F57F17;
    --warning-light: #FFF9C4;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Login ──────────────────────────────────────────────── */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 40px 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    text-align: center;
}

.login-icon { font-size: 48px; margin-bottom: 12px; }
.login-card h1 { font-size: 22px; color: var(--primary); margin-bottom: 4px; }
.login-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }

.field { margin-bottom: 16px; text-align: left; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}
.field input:focus { border-color: var(--primary); }

.btn-primary {
    width: 100%;
    padding: 13px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--text-secondary); cursor: not-allowed; }

.error-text { color: var(--error); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ── Layout ─────────────────────────────────────────────── */

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

.sidebar {
    width: 240px;
    background: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 24px 20px;
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.sidebar-icon { font-size: 24px; }

.sidebar-nav {
    list-style: none;
    flex: 1;
    padding: 12px 0;
}

.sidebar-nav li {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}
.sidebar-nav li:hover { background: rgba(255,255,255,0.1); }
.sidebar-nav li.active { background: rgba(255,255,255,0.2); font-weight: 600; }
.nav-icon { font-size: 18px; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.15); }

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

.content {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
}

/* ── Views ──────────────────────────────────────────────── */

.view { display: none; }
.view.active { display: block; }
.view h2 { font-size: 24px; font-weight: 700; margin-bottom: 24px; }

.view-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.view-header h2 { margin-bottom: 0; }

.badge {
    background: var(--primary-light);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

/* ── Stats ──────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-card .stat-icon { font-size: 32px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ── Table ──────────────────────────────────────────────── */

.table-container { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover td { background: #FAFAFA; }

.btn-view {
    padding: 6px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-view:hover { background: var(--primary-dark); }

/* ── User Detail ────────────────────────────────────────── */

.btn-back {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    padding: 0;
}
.btn-back:hover { text-decoration: underline; }

.user-header {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 28px;
    background: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
}

.user-info h3 { font-size: 18px; }
.user-info p { color: var(--text-secondary); font-size: 14px; }

.user-stats {
    display: flex;
    gap: 24px;
    margin-left: auto;
}

.user-stat { text-align: center; }
.user-stat-value { font-size: 22px; font-weight: 700; color: var(--primary); }
.user-stat-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; }

/* ── Tabs ───────────────────────────────────────────────── */

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Chat ───────────────────────────────────────────────── */

.chat-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.chat-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-size: 14px;
}

.chat-msg {
    margin-bottom: 12px;
    display: flex;
}

.chat-msg.user { justify-content: flex-end; }
.chat-msg.bot { justify-content: flex-start; }

.chat-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.chat-msg.user .chat-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-msg.bot .chat-bubble {
    background: #E8F5E9;
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chat-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.chat-msg.user .chat-time { text-align: right; }

/* ── Empty states ───────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-header span:last-child,
    .sidebar-nav li span:not(.nav-icon) { display: none; }
    .sidebar-header { padding: 16px; justify-content: center; }
    .sidebar-nav li { justify-content: center; padding: 12px; }
    .content { margin-left: 60px; padding: 20px; }
    .user-header { flex-direction: column; text-align: center; }
    .user-stats { margin-left: 0; }
}
