/* Variables & Theming - Elegant Blue Palette */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --primary-blue: #1D4ED8; 
    --primary-light: #EFF6FF;
    --primary-orange: #F59E0B;
    --bg-color: #F8FAFC; 
    --surface-solid: #FFFFFF;
    --text-main: #0F172A; 
    --text-muted: #64748B;
    --border: #E2E8F0;
    --card-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
    --sidebar-width: 260px;
    --success: #10B981;
    --danger: #EF4444;
    --radius: 16px;
}

[data-theme="dark"] {
    --primary-blue: #3B82F6;
    --primary-light: rgba(59, 130, 246, 0.1);
    --bg-color: #0B1120;
    --surface-solid: #1E293B;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --border: #334155;
    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Base Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex; min-height: 100vh;
    transition: background-color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Typography & Utilities */
h1, h2, h3, h4 { font-weight: 700; color: var(--text-main); }
.small-text { font-size: 0.85rem; color: var(--text-muted); }
.mt-10 { margin-top: 10px; } .mt-15 { margin-top: 15px; } .mt-20 { margin-top: 20px; } .mb-20 { margin-bottom: 20px; }
.p-15 { padding: 15px; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width); background: var(--surface-solid);
    border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 100;
}
.sidebar-header { padding: 24px; display: flex; align-items: center; gap: 12px; }
.logo-icon {
    background: linear-gradient(135deg, var(--primary-blue), #3B82F6);
    color: white; width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.nav-links { list-style: none; padding: 12px; display: flex; flex-direction: column; gap: 8px;}
.nav-links li {
    padding: 14px 20px; cursor: pointer; display: flex; gap: 14px; align-items: center;
    color: var(--text-muted); font-weight: 600; font-size: 0.95rem;
    border-radius: 12px; transition: all 0.2s;
}
.nav-links li:hover { background: var(--primary-light); color: var(--primary-blue); }
.nav-links li.active { background: var(--primary-blue); color: white; box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3); }

/* Main Content & Topbar */
.main-content { flex: 1; display: flex; flex-direction: column; overflow-x: hidden; }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; background: var(--surface-solid); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 90;
}
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.mobile-logo { display: none; }
.page-title { font-size: 1.2rem; font-weight: 700; color: var(--text-main); }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.user-profile { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 0.9rem;}
.avatar {
    background: var(--primary-light); color: var(--primary-blue);
    width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700;
}

.content-container { padding: 24px; max-width: 1200px; margin: 0 auto; width: 100%; }
.view-section { display: none; animation: slideUp 0.4s ease; }
.view-section.active { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* Modern Cards */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary-blue), #2563EB);
    color: white; padding: 24px; border-radius: var(--radius);
    margin-bottom: 24px; box-shadow: 0 8px 25px rgba(37, 99, 235, 0.2);
}
.welcome-banner h2 { color: white; margin-bottom: 4px;}

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface-solid); padding: 20px; border-radius: var(--radius);
    box-shadow: var(--card-shadow); border: 1px solid var(--border); display: flex; align-items: center; gap: 16px;
}
.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.icon-blue { background: var(--primary-light); color: var(--primary-blue); }
.icon-orange { background: rgba(245, 158, 11, 0.1); color: var(--primary-orange); }
.icon-green { background: rgba(16, 185, 129, 0.1); color: var(--success); }

/* Widgets */
.dashboard-widgets { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.widget, .card-modern { background: var(--surface-solid); padding: 24px; border-radius: var(--radius); box-shadow: var(--card-shadow); border: 1px solid var(--border); }
.widget-header h3 { font-size: 1.1rem; display: flex; align-items: center; gap: 8px;}
.action-list { list-style: none; }
.action-list li { padding: 14px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.action-list li:last-child { border-bottom: none; padding-bottom: 0;}

/* Buttons */
.btn {
    padding: 12px 20px; border-radius: 10px; border: none; font-weight: 600; font-size: 0.95rem;
    cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--primary-blue); color: white; box-shadow: 0 4px 12px rgba(29, 78, 216, 0.2); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(29, 78, 216, 0.3); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-main); }
.btn-outline:hover { border-color: var(--primary-blue); color: var(--primary-blue); }
.btn-whatsapp { background: #10B981; color: white; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);}
.btn-danger { background: var(--danger); color: white; }
.btn-icon { background: transparent; border: none; font-size: 1.3rem; color: var(--text-muted); cursor: pointer; }
.w-100 { width: 100%; }
.flex-actions { display: flex; gap: 12px; } .flex-1 { flex: 1; } .flex-2 { flex: 2; }

/* Tables */
.table-card { background: var(--surface-solid); border-radius: var(--radius); box-shadow: var(--card-shadow); border: 1px solid var(--border); padding: 0; overflow: hidden; }
.table-responsive { overflow-x: auto; }
.modern-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem;}
.modern-table th { padding: 16px; background: var(--bg-color); color: var(--text-muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }
.modern-table td { padding: 16px; border-bottom: 1px solid var(--border); vertical-align: middle;}
.badge { padding: 6px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; display: inline-block;}
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2);}
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--primary-orange); }
.badge-hot { background: rgba(245, 158, 11, 0.1); color: var(--primary-orange); }
.badge-cold { background: var(--bg-color); color: var(--text-muted); border: 1px solid var(--border);}
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }

/* Forms & Inputs */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-full { grid-column: 1 / -1; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; color: var(--text-main);}
input, select, textarea {
    width: 100%; padding: 14px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--bg-color);
    color: var(--text-main); font-family: inherit; font-size: 0.95rem; transition: all 0.2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-blue); background: var(--surface-solid); box-shadow: 0 0 0 3px var(--primary-light);}
.code-textarea { resize: vertical; line-height: 1.6; }
.recommendation-box { padding: 16px; background: var(--primary-light); border-radius: 12px; border: 1px solid rgba(29, 78, 216, 0.2);}

/* Layout */
.generator-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 24px; }
.flex-header { display: flex; justify-content: space-between; align-items: center; }

/* Modal */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.6); align-items: center; justify-content: center; backdrop-filter: blur(4px); padding: 20px;}
.modal-content { background: var(--surface-solid); width: 100%; max-width: 600px; border-radius: 20px; padding: 24px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); position: relative; animation: slideUp 0.3s ease; max-height: 90vh; overflow-y: auto;}
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 16px;}
.close { font-size: 1.8rem; cursor: pointer; color: var(--text-muted); line-height: 1;}

/* Toast */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--text-main); color: var(--surface-solid); padding: 14px 24px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,0.2); opacity: 0; transition: all 0.3s; z-index: 2000;}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

.status-dot { display: inline-block; width: 10px; height: 10px; background: var(--success); border-radius: 50%; }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); } 70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; bottom: 0; left: 0; width: 100%; height: 65px;
        flex-direction: row; border-right: none; border-top: 1px solid var(--border);
        padding: 0; box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
    }
    .sidebar-header { display: none; }
    .nav-links { flex-direction: row; width: 100%; justify-content: space-around; padding: 0; }
    .nav-links li {
        flex-direction: column; padding: 8px 0; border-radius: 0; gap: 4px; font-size: 0.65rem; font-weight: 600;
        border-top: 3px solid transparent; color: var(--text-muted); flex: 1; justify-content: center;
    }
    .nav-links li i { font-size: 1.1rem; }
    .nav-links li.active { background: transparent; color: var(--primary-blue); border-top: 3px solid var(--primary-blue); box-shadow: none; }
    .content-container { padding: 16px; padding-bottom: 90px; }
    .topbar { padding: 16px; }
    .mobile-logo { display: flex; width: 32px; height: 32px; font-size: 0.9rem;}
    .user-name { display: none; }
    .dashboard-widgets, .generator-grid, .form-grid { grid-template-columns: 1fr; gap: 16px;}
    .flex-header { flex-direction: column; align-items: flex-start; gap: 16px; }
    .actions { width: 100%; display: flex; gap: 10px; } .actions button { flex: 1; }
    .welcome-banner { padding: 20px; } .welcome-banner h2 { font-size: 1.3rem; }
    .flex-actions { flex-direction: column; } .btn { width: 100%; }
}