@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

:root {
    /* "Clean White" Theme Variables */

    /* Global Layout */
    --main-bg: #ffffff;
    --border: #e2e8f0;
    --text-dark: #0f172a;
    /* Slate-900 */
    --text-muted: #64748b;
    /* Slate-500 */

    /* Sidebar */
    --sidebar-bg: #ffffff;
    --sidebar-text: #64748b;
    --sidebar-active-bg: #f8fafc;
    --sidebar-active-text: #0f172a;

    /* Forms & Inputs */
    --input-bg: #ffffff;
    --input-border: #cbd5e1;

    /* Functional Colors */
    --primary: #2563eb;
    /* Blue-600 */
    --primary-light: #eff6ff;
    /* Blue-50 */
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--main-bg);
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
}

/* 
   ----------------------------------------
   UTILITIES & BUTTONS
   ----------------------------------------
*/
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-size: 0.9rem;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #f1f5f9;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    background: white;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f8fafc;
    color: var(--text-dark);
    border-color: #cbd5e1;
}

.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: var(--text-dark);
}

/* 
   ----------------------------------------
   LAYOUT & SIDEBAR
   ----------------------------------------
*/
.dashboard-layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.user-profile {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    /* Very subtle separator */
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-dark);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.search-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    color: var(--text-muted);
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-dark);
    width: 100%;
    outline: none;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--text-dark);
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    /* Subtle shadow for active item */
    font-weight: 600;
}

.nav-item i {
    width: 20px;
    margin-right: 0.75rem;
}

/* Sidebar Helpers */
.sidebar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-icon-small {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.85rem;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
}

.nav-item:hover .btn-icon-small {
    opacity: 1;
}

.btn-icon-small:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
}

.btn-icon-small.danger:hover {
    color: var(--danger);
    background: var(--warning-light);
}

/* 
   ----------------------------------------
   MAIN CONTENT & CONTENT AREA
   ----------------------------------------
*/
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--main-bg);
}

.top-bar {
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: flex-start;
    /* Align left for mobile toggle */
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    background: white;
    height: 60px;
}

.scroll-area {
    padding: 2rem;
    overflow-y: auto;
    height: 100%;
}

/* Date Groups */
.date-group {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    overflow: visible;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.date-header {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 12px 12px 0 0;
}

.date-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* 
   ----------------------------------------
   CARD ROWS
   ----------------------------------------
*/
.card-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    position: relative;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: background-color 0.2s;
}

.card-row:hover {
    background-color: #f8fafc;
}

.card-icon-box {
    width: 50px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.2rem;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.card-data-display {
    flex: 1;
    background: white;
    border: 1px solid var(--border);
    padding: 0 1rem;
    border-radius: 6px;
    height: 42px;
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
}

.card-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-dark);
    font-weight: 400;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Inline Input Form */
.inline-input-row {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.inline-input-row.visible {
    display: flex;
}

.inline-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    outline: none;
    background: white;
    color: var(--text-dark);
    transition: border-color 0.2s;
}

.inline-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.inline-form-actions {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.inline-form-actions .btn {
    flex: 1;
    justify-content: center;
}

.add-entry-trigger {
    width: 100%;
    border: 2px dashed var(--border);
    background: #f8fafc;
    color: var(--text-muted);
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-weight: 500;
}

.add-entry-trigger:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}

/* 
   ----------------------------------------
   AUTH (LOGIN / REGISTER) - CLEAN WHITE
   ----------------------------------------
*/
.auth-body {
    background-color: #f1f5f9;
    /* Slate-100 for page bg */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    background: white;
    border: 1px solid var(--border);
    padding: 2.5rem;
    border-radius: 1rem;
    width: 100%;
    max-width: 420px;
    color: var(--text-dark);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.05);
    /* Premium shadow */
    overflow: hidden;
    /* Prevent overflow */
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.auth-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    letter-spacing: -0.025em;
    text-align: center;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1rem;
    text-align: center;
}

/* Form Groups & Controls */
.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    color: var(--text-dark);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-footer {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
}

.form-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* 
   ----------------------------------------
   MODALS
   ----------------------------------------
*/
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 17, 26, 0.4);
    /* Lighter backdrop */
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
    border: 1px solid var(--border);
    animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 
   ----------------------------------------
   MOBILE RESPONSIVENESS
   ----------------------------------------
*/
.mobile-menu-toggle {
    display: none;
    /* Hidden by default */
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 4px;
}

.mobile-menu-toggle:hover {
    background: #f1f5f9;
    color: var(--text-dark);
}

.sidebar-close {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .dashboard-layout {
        position: relative;
    }

    .sidebar {
        position: fixed;
        width: 80%;
        max-width: 300px;
        height: 100%;
        top: 0;
        left: -100%;
        /* Hidden off-screen */
        z-index: 1000;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
        padding-top: 3.5rem;
        /* Space for close btn */
    }

    .sidebar.active {
        left: 0;
        transform: none;
    }

    .sidebar-close {
        display: block;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .main-content {
        width: 100%;
    }

    .top-bar {
        padding: 0.8rem 1rem;
    }

    .scroll-area {
        padding: 0 !important;
        /* Sin padding en móvil para ancho completo */
    }

    .date-group {
        margin-bottom: 0.5rem !important;
        border-radius: 0 !important;
        /* Sin bordes redondeados en móvil */
        border-left: none !important;
        border-right: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .date-body {
        padding: 0.5rem !important;
        /* Padding mínimo */
        gap: 0.5rem;
    }

    .card-row {
        flex-wrap: wrap;
        padding: 0.5rem;
        gap: 0.5rem;
        border-radius: 0;
        /* Sin bordes redondeados */
    }

    .card-icon-box {
        display: none !important;
        /* Ocultar icono en móvil para ver números completos */
    }

    .card-row:hover {
        background: transparent;
    }

    /* Remove hover effect on touch */

    .card-icon-box {
        width: 40px;
        /* Smaller icon box */
        height: 40px;
        font-size: 1rem;
    }

    .card-data-display {
        width: auto;
        /* Let it shrink/grow */
        flex: 1;
        /* Take remaining space */
        margin: 0;
        /* Remove margin */
        padding: 0 0.5rem;
        /* Tighter padding */
        height: 40px;
        /* Match icon box */
    }

    .action-group {
        width: auto;
        /* Don't force full width */
        margin-left: auto;
        /* Push to right */
    }
}