/**
 * VirtualNutri+ Custom Styles
 * Inspirado no design do gestao-isp
 * Author: Claude Code 2025
 */

/* ========================================
   DESIGN TOKENS & CSS VARIABLES
   ======================================== */

:root {
    /* Brand Colors - Clean & Minimalista */
    --brand-primary: #1DD1A1;        /* Verde menta vibrante */
    --brand-secondary: #00C48C;      /* Verde turquesa */
    --brand-accent: #10AC84;         /* Verde médio */
    --brand-background: #F8F9FA;     /* Branco clean */
    --brand-surface: #FFFFFF;        /* Branco puro */

    /* Semantic Colors - Vibrantes e modernas */
    --success: #1DD1A1;
    --danger: #FF6B6B;
    --warning: #FFA502;
    --info: #70A1FF;

    /* Categoria Colors (para badges) */
    --category-carbs: #70A1FF;       /* Azul claro */
    --category-protein: #FFA502;     /* Laranja */
    --category-fat: #FFD93D;         /* Amarelo */

    /* Neutrals - Limpos e modernos */
    --text-primary: #2D3436;         /* Cinza escuro */
    --text-secondary: #636E72;       /* Cinza médio */
    --text-disabled: #B2BEC3;        /* Cinza claro */
    --surface-border: #DFE6E9;       /* Cinza muito claro */
    --surface-hover: #F5F6F7;        /* Quase branco */

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --sidebar-gradient-start: #FFFFFF;
    --sidebar-gradient-end: #FFFFFF;
    --sidebar-text: #2D3436;
    --sidebar-active: #1DD1A1;

    /* Border Radius - Mais arredondado */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-pill: 50px;

    /* Shadows - Muito sutis */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --brand-surface: #1e1e1e;
    --text-primary: #e4e4e4;
    --text-secondary: #a0a0a0;
    --surface-border: #3c3c3c;
    --surface-hover: #2d2d2d;
    --brand-background: #121212;
}

/* ========================================
   GLOBAL STYLES
   ======================================== */

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--brand-background);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

a {
    color: var(--brand-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--brand-primary);
}

/* ========================================
   LAYOUT STRUCTURE
   ======================================== */

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

.main-content {
    flex: 1;
    margin-left: var(--sidebar-collapsed-width);
    transition: margin-left var(--transition-base);
    display: flex;
    flex-direction: column;
}

.main-content.sidebar-expanded {
    margin-left: var(--sidebar-width);
}

/* ========================================
   SIDEBAR NAVIGATION
   ======================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-collapsed-width);
    background: #1a1a1a;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: hidden;
    overflow-y: auto;
    transition: width var(--transition-base);
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar:hover,
.sidebar.expanded {
    width: var(--sidebar-width);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    min-height: 70px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--brand-primary);
}

.sidebar-brand-text {
    margin-left: 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar:hover .sidebar-brand-text,
.sidebar.expanded .sidebar-brand-text {
    opacity: 1;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    margin: 0.25rem 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    border-radius: var(--radius-md);
    text-decoration: none;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--brand-primary);
}

.nav-item.active {
    background-color: rgba(29, 209, 161, 0.15);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-item-icon {
    width: 20px;
    min-width: 20px;
    font-size: 1.25rem;
    text-align: center;
}

.nav-item-text {
    margin-left: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar:hover .nav-item-text,
.sidebar.expanded .nav-item-text {
    opacity: 1;
}

.nav-divider {
    height: 1px;
    margin: 0.75rem 1.25rem;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Badge de notificação */
.nav-badge {
    position: absolute;
    right: 1rem;
    background-color: var(--danger);
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar:hover .nav-badge,
.sidebar.expanded .nav-badge {
    opacity: 1;
}

/* ========================================
   TOPBAR
   ======================================== */

.topbar {
    height: 70px;
    background-color: var(--brand-surface);
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none; /* Mostrar apenas em mobile */
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-search {
    position: relative;
    width: 300px;
}

.topbar-search input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.topbar-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.topbar-btn:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.topbar-btn .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--danger);
    color: white;
    font-size: 0.65rem;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.user-menu:hover {
    background-color: var(--surface-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ========================================
   CONTENT AREA
   ======================================== */

.content-wrapper {
    flex: 1;
    padding: 2rem;
}

.container-fluid {
    max-width: 100%;
    margin: 0 auto;
}

/* Breadcrumb */
.breadcrumb {
    background: none;
    padding: 0;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--text-secondary);
}

.breadcrumb-item a {
    color: var(--text-secondary);
}

.breadcrumb-item.active {
    color: var(--text-primary);
}

/* ========================================
   CARDS
   ======================================== */

.card {
    background-color: var(--brand-surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--surface-border);
    background-color: var(--surface-hover);
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.stat-icon.success {
    background-color: rgba(46, 143, 85, 0.1);
    color: var(--success);
}

.stat-icon.info {
    background-color: rgba(91, 155, 213, 0.1);
    color: var(--info);
}

.stat-icon.warning {
    background-color: rgba(242, 159, 92, 0.1);
    color: var(--warning);
}

.stat-icon.danger {
    background-color: rgba(192, 75, 75, 0.1);
    color: var(--danger);
}

.stat-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--brand-secondary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--brand-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-outline-primary {
    background-color: transparent;
    border: 1px solid var(--brand-secondary);
    color: var(--brand-secondary);
}

.btn-outline-primary:hover {
    background-color: var(--brand-secondary);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* ========================================
   FORMS
   ======================================== */

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    background-color: var(--brand-surface);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-secondary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-control::placeholder {
    color: var(--text-disabled);
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23718096' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    border: 2px solid var(--surface-border);
    border-radius: 4px;
}

.form-check-input:checked {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
}

/* ========================================
   TABLES
   ======================================== */

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table thead {
    background-color: var(--surface-hover);
    border-bottom: 2px solid var(--surface-border);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--surface-border);
}

.table tbody tr {
    transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
    background-color: var(--surface-hover);
}

.table-sortable th {
    cursor: pointer;
    user-select: none;
}

.table-sortable th:hover {
    color: var(--brand-secondary);
}

/* ========================================
   BADGES & PILLS
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.badge-success {
    background-color: rgba(46, 143, 85, 0.1);
    color: var(--success);
}

.badge-danger {
    background-color: rgba(192, 75, 75, 0.1);
    color: var(--danger);
}

.badge-warning {
    background-color: rgba(242, 159, 92, 0.1);
    color: var(--warning);
}

.badge-info {
    background-color: rgba(91, 155, 213, 0.1);
    color: var(--info);
}

/* ========================================
   UTILITIES
   ======================================== */

.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }
.p-3 { padding: 1rem; }

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        width: var(--sidebar-width);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .topbar-search {
        display: none;
    }

    .content-wrapper {
        padding: 1rem;
    }
}

/* ========================================
   STAT CARDS
   ======================================== */

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.stat-icon.success {
    background-color: rgba(46, 143, 85, 0.1);
    color: var(--success);
}

.stat-icon.info {
    background-color: rgba(66, 153, 225, 0.1);
    color: var(--info);
}

.stat-icon.warning {
    background-color: rgba(242, 159, 92, 0.1);
    color: var(--warning);
}

.stat-icon.danger {
    background-color: rgba(192, 75, 75, 0.1);
    color: var(--danger);
}

.stat-icon.primary {
    background-color: rgba(46, 125, 50, 0.1);
    color: var(--brand-primary);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.stat-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========================================
   TIMELINE
   ======================================== */

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--surface-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-icon {
    position: absolute;
    left: -2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-surface);
    border: 2px solid var(--surface-border);
    font-size: 1rem;
    z-index: 1;
}

.timeline-icon.success {
    background-color: rgba(46, 143, 85, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.timeline-icon.info {
    background-color: rgba(66, 153, 225, 0.1);
    color: var(--info);
    border-color: var(--info);
}

.timeline-icon.primary {
    background-color: rgba(46, 125, 50, 0.1);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.timeline-content {
    padding-left: 1rem;
}

.timeline-content small {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
}

.timeline-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .stat-content h3 {
        font-size: 1.75rem;
    }
}
