/* 
   Style definitions inspired by Mindfulness y Empresa
   Aesthetic: Healthy, calming, modern, using clean typography and teal-green palettes.
*/

:root {
    --color-primary: #0f766e;        /* Dark teal */
    --color-primary-light: #0d9488;  /* Light teal */
    --color-primary-subtle: #f0fdfa; /* Extremely soft teal background */
    --color-secondary: #059669;      /* Calming green */
    --color-accent: #0284c7;         /* Safe blue for targets */
    
    /* Neutral colors */
    --color-bg-body: #f8fafc;
    --color-bg-card: #ffffff;
    --color-text-main: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-border-hover: #cbd5e1;
    
    /* Status colors */
    --color-underweight: #eab308;    /* Warm amber */
    --color-normal: #10b981;         /* Healthy green */
    --color-overweight: #f97316;     /* Warning orange */
    --color-obese: #ef4444;          /* Red */
    
    /* Typography */
    --font-main: 'Inter', sans-serif;
    --font-title: 'Montserrat', sans-serif;
    
    /* Shadow */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 118, 110, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(15, 118, 110, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--color-bg-body);
    color: var(--color-text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Typography Utils */
h1, h2, h3, h4 {
    font-family: var(--font-title);
    font-weight: 600;
}

/* Header */
.app-header {
    background-color: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    padding: 1.25rem 0;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    background-color: var(--color-primary-subtle);
    color: var(--color-primary);
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon i {
    width: 1.5rem;
    height: 1.5rem;
}

.logo-area h1 {
    font-size: 1.25rem;
    color: var(--color-primary);
}

.logo-area .subtitle {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-main);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: var(--color-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.2);
}

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

.btn-secondary:hover {
    background-color: #ccfbf1;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--color-border);
    color: var(--color-text-main);
}

.btn-outline:hover {
    background-color: var(--color-bg-body);
    border-color: var(--color-border-hover);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Alert profile setup */
.profile-alert {
    background-color: var(--color-primary-subtle);
    border: 1px solid rgba(13, 148, 136, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    animation: fadeIn var(--transition-normal);
}

.alert-content {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.alert-icon {
    color: var(--color-primary-light);
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}

.alert-content h3 {
    font-size: 1rem;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.alert-content p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.kpi-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.kpi-title {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.text-teal { color: var(--color-primary-light); }
.text-green { color: var(--color-secondary); }
.text-blue { color: var(--color-accent); }

.kpi-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--color-text-main);
    font-family: var(--font-title);
    line-height: 1;
    margin-bottom: 0.75rem;
}

.kpi-value .unit {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.kpi-footer {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

/* Trend indicator */
.trend-up {
    color: var(--color-obese);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trend-down {
    color: var(--color-normal);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trend-neutral {
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* BMI Status badge styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.badge-underweight { background-color: #fef9c3; color: #854d0e; }
.badge-normal { background-color: #d1fae5; color: #065f46; }
.badge-overweight { background-color: #ffedd5; color: #9a3412; }
.badge-obese { background-color: #fee2e2; color: #991b1b; }

/* Progress goals KPI */
.progress-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.progress-bar-container {
    background-color: var(--color-border);
    height: 8px;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    background-color: var(--color-accent);
    height: 100%;
    border-radius: 9999px;
    transition: width var(--transition-normal);
}

/* Workspace layout */
.dashboard-workspace {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.workspace-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.workspace-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Standard Card Styles */
.card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 1.15rem;
    color: var(--color-primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    width: 1.25rem;
    height: 1.25rem;
}

.card-title-sm {
    font-size: 0.95rem;
    color: var(--color-text-main);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title-sm i {
    width: 1.1rem;
    height: 1.1rem;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-main);
    margin-bottom: 0.375rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding-right: 2.5rem;
}

input[type="number"], 
input[type="date"] {
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--color-text-main);
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    outline: none;
    transition: all var(--transition-fast);
}

input[type="number"]:focus, 
input[type="date"]:focus {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.input-suffix {
    position: absolute;
    right: 0.875rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    pointer-events: none;
}

.form-help {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Backup tools cards */
.backup-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.backup-actions button, 
.backup-actions .label-import {
    flex: 1;
    text-align: center;
}

.label-import {
    margin: 0;
}

.backup-info {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: center;
}

/* Chart Card Styles */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.chart-header .card-title {
    margin-bottom: 0;
}

.chart-filters {
    display: flex;
    background-color: var(--color-bg-body);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.filter-btn {
    border: none;
    background-color: transparent;
    padding: 0.35rem 0.75rem;
    font-family: var(--font-main);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    color: var(--color-text-main);
}

.filter-btn.active {
    background-color: var(--color-bg-card);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* History table */
.history-table-wrapper {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.history-table th, 
.history-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border);
}

.history-table th {
    font-family: var(--font-title);
    font-weight: 600;
    color: var(--color-text-muted);
    background-color: var(--color-bg-body);
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tbody tr:hover {
    background-color: var(--color-primary-subtle);
}

.empty-state {
    text-align: center;
    color: var(--color-text-muted);
    padding: 2.5rem 1rem !important;
}

.cell-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    border: none;
    background: transparent;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-edit {
    color: var(--color-primary-light);
}

.btn-edit:hover {
    background-color: var(--color-primary-subtle);
}

.btn-delete {
    color: #ef4444;
}

.btn-delete:hover {
    background-color: #fee2e2;
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.modal.hidden {
    display: none !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 118, 110, 0.4);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background-color: var(--color-bg-card);
    width: 100%;
    max-width: 460px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    animation: slideUp var(--transition-normal);
    overflow: hidden;
}

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

.modal-header h2 {
    font-size: 1.15rem;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h2 i {
    width: 1.25rem;
    height: 1.25rem;
}

.modal-close {
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 6px;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--color-bg-body);
    color: var(--color-text-main);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background-color: var(--color-bg-body);
    border-top: 1px solid var(--color-border);
}

/* Footer styling */
.app-footer {
    background-color: var(--color-bg-card);
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.footer-tagline {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--color-primary-light);
}

/* Toasts notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 110;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background-color: var(--color-bg-card);
    border-left: 4px solid var(--color-primary);
    box-shadow: var(--shadow-lg);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    animation: slideInRight var(--transition-normal);
}

.toast.success { border-left-color: var(--color-normal); }
.toast.info { border-left-color: var(--color-accent); }
.toast.error { border-left-color: #ef4444; }

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-main);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive grid adjustments */
@media (max-width: 900px) {
    .dashboard-workspace {
        grid-template-columns: 1fr;
    }
    
    .workspace-sidebar {
        order: 1;
    }
}

@media (max-width: 600px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .logo-area {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .backup-actions {
        flex-direction: column;
    }
}
