/* Mobile-First CSS for EDA Tracker - iPhone 17 Pro optimized */
/* Fitness theme: Green and Orange palette */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Fitness color palette */
    --primary-green: #4CAF50;
    --primary-green-dark: #388E3C;
    --accent-orange: #FFA726;
    --accent-orange-dark: #F57C00;
    --bg-light: #FAFAFA;
    --bg-white: #FFFFFF;
    --text-dark: #333333;
    --text-muted: #757575;
    --border-color: #E0E0E0;
    --error-color: #E53935;
    --success-color: #43A047;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* iPhone 17 Pro safe areas */
    --safe-area-top: env(safe-area-inset-top, 0);
    --safe-area-bottom: env(safe-area-inset-bottom, 0);
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-dark);
    background-color: var(--bg-light);
    padding-top: var(--safe-area-top);
    padding-bottom: calc(60px + var(--safe-area-bottom));
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 100%;
    padding: var(--spacing-md);
    padding-bottom: var(--spacing-xl);
}

/* Typography */
h1, h2, h3 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-dark);
}

h1 {
    font-size: 26px;
    margin-bottom: var(--spacing-sm);
    color: var(--text-dark);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

h2 {
    font-size: 18px;
    margin-bottom: var(--spacing-md);
    font-weight: 700;
    color: var(--text-dark);
}

h3 {
    font-size: 18px;
    margin-bottom: var(--spacing-sm);
}

.text-muted {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: var(--spacing-lg);
    background-color: #F5F5F5;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    min-height: 48px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 50%, #388E3C 100%);
    color: var(--bg-white);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover,
.btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #FFA726 0%, #FF9800 50%, #F57C00 100%);
    color: var(--bg-white);
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.35);
    position: relative;
    overflow: hidden;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.btn-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-secondary:hover::before {
    left: 100%;
}

.btn-secondary:hover,
.btn-secondary:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 167, 38, 0.45);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-danger {
    background-color: var(--error-color);
    color: var(--bg-white);
}

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 8px 16px;
    min-height: 36px;
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-md);
}

label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
    color: var(--text-dark);
}

/* Nutrition section (compact form layout) */
.nutrition-section {
    margin-bottom: var(--spacing-md);
}

.nutrition-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.nutrition-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.nutrition-row .form-group {
    margin-bottom: 0;
}

.nutrition-row .form-group label {
    font-size: 14px;
}

.nutrition-row input[type="number"] {
    font-size: 15px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    padding: 12px;
    min-height: 48px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-white);
    color: var(--text-dark);
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-green);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Cards */
.card {
    background-color: var(--bg-white);
    border-radius: 16px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #F0F0F0;
}

/* Product card */
.product-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: var(--spacing-xs);
}

.product-stats {
    font-size: 13px;
    color: var(--text-muted);
}

.product-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.product-actions .btn {
    padding: 4px 8px;
    min-height: 32px;
    font-size: 12px;
}

/* Log entries container */
.log-entries-container {
    background-color: var(--bg-white);
    border-radius: 12px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #E8E8E8;
}

/* Log entry card */
.log-entry {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid #F0F0F0;
    transition: background-color 0.15s ease;
}

.log-entry:hover {
    background-color: #FAFAFA;
}

.log-entry:first-child {
    padding-top: 0;
}

.log-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.log-header .btn {
    padding: 6px;
    min-height: 36px;
    width: 36px;
    font-size: 16px;
    border-radius: 8px;
    flex-shrink: 0;
}

.log-product-name {
    font-weight: 600;
    font-size: 17px;
    color: var(--text-dark);
    line-height: 1.3;
    margin-bottom: 4px;
}

.log-weight {
    font-size: 13px;
    color: var(--text-muted);
    background-color: #F0F0F0;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    font-weight: 500;
}

.log-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
    background-color: var(--bg-white);
    padding: var(--spacing-sm);
    border-radius: 8px;
    flex: 1;
}

.log-entry .product-content {
    gap: var(--spacing-sm);
}

.stat-item {
    text-align: center;
    padding: 4px;
}

.stat-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-item:nth-child(1) .stat-label {
    color: #FF6B6B;
}

.stat-item:nth-child(2) .stat-label {
    color: #4ECDC4;
}

.stat-item:nth-child(3) .stat-label {
    color: #FFE66D;
}

.stat-item:nth-child(4) .stat-label {
    color: #95E1D3;
}

.stat-value {
    display: block;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-dark);
}

/* Totals card */
.totals-card {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 50%, #388E3C 100%);
    color: var(--bg-white);
    border-radius: 20px;
    padding: 24px;
    margin: var(--spacing-lg) 0;
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.35);
    position: relative;
    overflow: hidden;
}

/* Decorative element */
.totals-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.totals-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.95;
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    position: relative;
    z-index: 1;
}

.total-item {
    text-align: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: transform 0.2s ease, background 0.2s ease;
}

.total-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
}

.total-label {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background-color: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding-bottom: var(--safe-area-bottom);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    min-height: 60px;
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.nav-item:active {
    background-color: var(--bg-light);
}

.nav-item.active {
    color: var(--primary-green);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 2px;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
}

/* Login page */
.login-container {
    max-width: 360px;
    margin: 60px auto;
    padding: var(--spacing-md);
}

.login-card {
    background-color: var(--bg-white);
    border-radius: 16px;
    padding: var(--spacing-xl);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.login-title {
    text-align: center;
    font-size: 28px;
    color: var(--primary-green);
    margin-bottom: var(--spacing-xl);
}

.error-message {
    background-color: #FFEBEE;
    color: var(--error-color);
    padding: var(--spacing-md);
    border-radius: 8px;
    margin-bottom: var(--spacing-md);
    font-size: 14px;
}

.success-message {
    background-color: #E8F5E9;
    color: var(--success-color);
    padding: var(--spacing-md);
    border-radius: 8px;
    margin-bottom: var(--spacing-md);
    font-size: 14px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
}

/* Action buttons row */
.btn-group {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.btn-group .btn {
    flex: 1;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--spacing-sm);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
}

.table tbody tr:hover {
    background-color: var(--bg-light);
}

/* Desktop responsiveness */
@media (min-width: 768px) {
    .container {
        max-width: 768px;
        margin: 0 auto;
    }
    
    .login-container {
        max-width: 480px;
    }
    
    .totals-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 960px;
    }
    
    body {
        padding-bottom: 0;
    }
    
    .bottom-nav {
        position: relative;
        box-shadow: none;
        border-top: none;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: var(--spacing-lg);
    }
}

/* Product tabs */
.product-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
    background-color: #F5F5F5;
    border-radius: 12px;
}

.product-tab {
    flex: 1;
    min-width: fit-content;
    padding: 12px 16px;
    background-color: transparent;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    position: relative;
}

.product-tab:hover {
    color: var(--text-dark);
    background-color: rgba(255, 255, 255, 0.5);
}

.product-tab.active {
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 50%, #388E3C 100%);
    color: var(--bg-white);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

/* Compact product card */
.product-card-compact {
    padding: var(--spacing-md);
    border-bottom: 1px solid #F0F0F0;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin: 0 calc(var(--spacing-md) * -1);
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

.product-card-compact:hover {
    background-color: #FAFAFA;
    transform: translateX(4px);
    border-left: 3px solid var(--primary-green);
    padding-left: calc(var(--spacing-md) - 3px);
}

.product-card-compact:last-child {
    border-bottom: none;
}

.product-header {
    margin-bottom: var(--spacing-sm);
}

.product-name-compact {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.3;
}

.product-actions-compact {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-left: auto;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    min-height: 36px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-icon:nth-child(1) {
    background: linear-gradient(135deg, #FFA726 0%, #FF9800 100%);
    color: var(--bg-white);
}

.btn-icon:nth-child(1):hover,
.btn-icon:nth-child(1):active {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.4);
}

.btn-icon:nth-child(2),
form .btn-icon {
    background: linear-gradient(135deg, #E53935 0%, #D32F2F 100%);
    color: var(--bg-white);
}

.btn-icon:nth-child(2):hover,
.btn-icon:nth-child(2):active,
form .btn-icon:hover,
form .btn-icon:active {
    background: linear-gradient(135deg, #D32F2F 0%, #C62828 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.4);
}

.btn-icon:active {
    transform: translateY(0) !important;
}

.product-content {
    display: flex;
    gap: var(--spacing-md);
}

.product-image-container {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
}

.product-image-compact {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.product-image-compact:hover {
    transform: scale(1.05);
}

.product-placeholder {
    width: 70px;
    height: 70px;
    background-color: #f5f5f5;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #bdbdbd;
}

.product-info-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-nutrition {
    font-size: 15px;
    color: var(--text-dark);
}

.product-nutrition strong {
/*    font-weight: 600; */
}

.product-macros {
    font-size: 15px;
    /* color: var(--text-muted); */
    color: var(--text-dark);
}

.product-manufacturer {
    font-size: 13px;
    color: var(--text-muted);
    color: var(--text-dark);
    font-style: italic;
}

/* Photo edit section (for editing mode) */
.photo-edit-section {
    margin-bottom: var(--spacing-md);
}

.photo-edit-container {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-start;
}

.photo-edit-preview {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--bg-light);
    border: 2px solid var(--border-color);
}

.edit-photo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.edit-photo-image:hover {
    transform: scale(1.05);
}

.edit-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #bdbdbd;
    background-color: #f5f5f5;
}

.photo-edit-actions {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.photo-edit-actions .btn {
    width: 100%;
}

/* Stats page - Date range selector */
.date-range-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.date-input-wrapper {
    flex: 1;
    position: relative;
    min-width: 0;
}

.date-input-wrapper input[type="date"] {
    width: 100%;
    padding: 12px;
    min-height: 48px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-white);
    color: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.date-input-wrapper input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-green);
}

.date-input-wrapper input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.date-display {
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    padding: 10px;
    font-size: 16px;
    background-color: var(--bg-white);
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    border-radius: 6px;
}

.date-display::after {
    content: '📅';
    font-size: 18px;
    opacity: 0.6;
}

.date-separator {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    flex-shrink: 0;
    padding: 0 4px;
}

/* Stats page - Charts grid */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

@media (min-width: 768px) {
    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.chart-container {
    background-color: var(--bg-white);
    border-radius: 16px;
    padding: var(--spacing-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #F0F0F0;
}

/* Stats type selector */
.stats-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.stats-type-selector .btn {
    margin: 0;
}

/* Stats table */
.stats-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.stats-table thead {
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 50%, #388E3C 100%);
    color: var(--bg-white);
}

.stats-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: none;
}

.stats-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.stats-table tbody tr:hover {
    background-color: #FAFAFA;
}

.stats-table tbody tr:last-child td {
    border-bottom: none;
}

.stats-table td:first-child {
    font-weight: 600;
    color: var(--text-dark);
}

.stats-table td:nth-child(2) {
    color: #FF6B6B;
    font-weight: 600;
}

.stats-table td:nth-child(3) {
    color: #4ECDC4;
    font-weight: 600;
}

.stats-table td:nth-child(4) {
    color: #FFE66D;
    font-weight: 600;
}

.stats-table td:nth-child(5) {
    color: #95E1D3;
    font-weight: 600;
}

.stats-table .btn-icon {
    margin: 0 auto;
    display: flex;
}

/* Utility classes */
.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.text-center {
    text-align: center;
}

.hidden {
    display: none;
}

/* Product search dropdown */
.product-search-wrapper {
    position: relative;
}

.product-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    z-index: 10;
}

.product-search-clear:hover,
.product-search-clear:active {
    background-color: var(--bg-light);
    color: var(--text-dark);
}

.product-search-wrapper input[type="text"] {
    padding-right: 44px;
}

.product-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-white);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.product-dropdown.show {
    display: block;
}

.product-dropdown-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.product-dropdown-item:last-child {
    border-bottom: none;
}

.product-dropdown-item:hover,
.product-dropdown-item:active {
    background-color: var(--bg-light);
}

.product-dropdown-item.selected {
    background-color: #E8F5E9;
}

.product-dropdown-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Mobile optimized stats table */
.stats-table-mobile {
    font-size: 13px;
}

.stats-table-mobile th,
.stats-table-mobile td {
    padding: 10px 6px;
    text-align: center;
}

.stats-table-mobile th:first-child,
.stats-table-mobile td:first-child {
    text-align: left;
    padding-left: 8px;
    min-width: 60px;
}

.stats-date-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.btn-delete-mini {
    background: transparent;
    border: none;
    font-size: 14px;
    padding: 2px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
    flex-shrink: 0;
}

.btn-delete-mini:hover,
.btn-delete-mini:active {
    opacity: 1;
    transform: scale(1.2);
}

.stats-table-mobile th {
    font-size: 12px;
    padding: 10px 6px;
    white-space: nowrap;
}

.stats-table-mobile td {
    font-size: 14px;
    font-weight: 500;
}

/* Total row styling */
.stats-total-row {
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 50%, #388E3C 100%);
    color: var(--bg-white);
}

.stats-total-row td {
    border-bottom: none;
    padding: 14px 6px;
    font-size: 15px;
}

.stats-total-row td:first-child {
    padding-left: 8px;
}

.stats-total-row:hover {
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 50%, #388E3C 100%);
}

@media (max-width: 375px) {
    .stats-table-mobile {
        font-size: 12px;
    }
    
    .stats-table-mobile th,
    .stats-table-mobile td {
        padding: 8px 4px;
    }
    
    .stats-table-mobile th:first-child,
    .stats-table-mobile td:first-child {
        padding-left: 6px;
    }
    
    .stats-table-mobile td {
        font-size: 13px;
    }
    
    .stats-total-row td {
        padding: 12px 4px;
        font-size: 14px;
    }
    
    .stats-total-row td:first-child {
        padding-left: 6px;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-white);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover,
.modal-close:active {
    background-color: var(--bg-light);
    color: var(--text-dark);
}

.modal-content form {
    padding: var(--spacing-lg);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.modal-actions .btn {
    flex: 1;
}

.readonly-input {
    background-color: var(--bg-light);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Day Details Modal */
.modal-body {
    padding: var(--spacing-lg);
}

.modal-loading {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--spacing-md);
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.modal-error {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--error-color);
    font-size: 16px;
}

.day-details-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 50%, #388E3C 100%);
    border-radius: 12px;
}

.summary-item {
    text-align: center;
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.summary-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
    font-weight: 500;
}

.summary-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--bg-white);
    line-height: 1.2;
}

.modal-body h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.product-item {
    background-color: var(--bg-light);
    border-radius: 8px;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.product-item:hover {
    background-color: #F5F5F5;
    transform: translateX(4px);
    border-left: 3px solid var(--primary-green);
}

.product-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.product-item .product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.3;
    flex: 1;
}

.product-weight {
    font-size: 13px;
    color: var(--text-muted);
    background-color: var(--bg-white);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    margin-left: var(--spacing-sm);
}

.product-item-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dark);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.product-item-stats span {
    background-color: var(--bg-white);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Clickable table row */
.stats-row-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.stats-row-clickable:hover {
    background-color: #E8F5E9 !important;
    transform: translateX(4px);
}

.stats-row-clickable:active {
    background-color: #C8E6C9 !important;
}

@media (max-width: 480px) {
    .day-details-summary {
        grid-template-columns: 1fr;
    }
    
    .product-item-stats {
        font-size: 12px;
    }
    
    .modal-content {
        margin: var(--spacing-sm);
        max-height: 95vh;
    }
}
