/* Data Views — Lists, Forms, Details */

/* === Data Card === */
.data-card {
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-card);
    overflow: hidden;
    margin-bottom: 24px;
    background-color: var(--bg-card);
    color: var(--text);
}

.data-card .card-header {
    background-color: var(--bg-card-header);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    color: var(--text-card-header);
}

.data-card .card-header h2 {
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.data-card .card-body {
    padding: 18px 20px;
}

/* === Data Table === */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background-color: var(--bg-table-header);
    color: var(--text-table-header);
    font-weight: 600;
    padding: 12px 16px;
    font-size: 0.775rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border);
    border-top: none;
    white-space: nowrap;
}

.data-table tr {
    transition: background-color 0.12s ease;
}

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

/* CRITICAL FIX: Do NOT set background-color on td — it overrides tr:hover */
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}

.data-table tbody td:first-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.data-table tbody td:last-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

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

.data-table .action-cell {
    text-align: right;
    white-space: nowrap;
}

/* === Action Buttons === */
.action-buttons {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.action-btn {
    padding: 5px 7px;
    border-radius: 10px;
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.action-btn i {
    font-size: 0.85rem;
}

.action-btn-edit:hover {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border-color: rgba(var(--primary-rgb), 0.3);
    transform: translateY(-1px);
}

.action-btn-delete:hover {
    background-color: rgba(237, 73, 86, 0.1);
    color: var(--btn-danger);
    border-color: rgba(237, 73, 86, 0.3);
    transform: translateY(-1px);
}

/* === Header Actions === */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.header-btn {
    padding: 8px 16px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

.header-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.header-btn:active {
    transform: translateY(0);
}

.header-btn-primary {
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 100%), var(--primary);
    color: white;
    box-shadow: 0 1px 3px rgba(var(--primary-rgb), 0.25);
}
.header-btn-primary:hover {
    color: white;
}

.header-btn-secondary {
    background-color: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 1px solid var(--btn-secondary-border);
}
.header-btn-secondary:hover {
    color: var(--text);
}

.header-btn-export {
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 100%), var(--diaper-color);
    color: white;
}
.header-btn-export:hover {
    color: white;
}

.header-btn-chart {
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 100%), var(--weight-color);
    color: white;
}
.header-btn-chart:hover {
    color: white;
}

/* === Form Card === */
.form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px 0;
}

.form-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--border-card);
}

.form-card-header {
    padding: 16px 20px;
    background-color: var(--bg-card-header);
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.form-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: -0.2px;
}

.form-card-body {
    padding: 22px 20px;
}

.form-group {
    margin-bottom: 18px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* === Data Table Container === */
.data-table-container {
    background-color: var(--bg-card);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--border-card);
}

/* === Data View Layout === */
.data-view-container {
    padding: 16px 0;
}

.data-view-header {
    margin-bottom: 20px;
}

.data-view-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.4px;
}

.data-view-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

.data-view-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.data-view-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* === Color Definitions === */
.feeding-color { color: var(--feeding-color) !important; }
.weight-color { color: var(--weight-color) !important; }
.diaper-color { color: var(--diaper-color) !important; }
.pump-color { color: var(--pump-color) !important; }

.bg-weight { background-color: var(--weight-color); }
.bg-feeding { background-color: var(--feeding-color); }
.bg-diaper { background-color: var(--diaper-color); }
.bg-pump { background-color: var(--pump-color); }

/* === Notes === */
.notes-text {
    color: var(--text-secondary);
    font-style: italic;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 0.875rem;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 48px 20px;
}

.empty-state-icon {
    font-size: 3.5rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: block;
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 20px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.empty-state-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 100%), var(--primary);
    color: white;
    border: none;
    padding: 11px 28px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.empty-state-btn:hover {
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%), var(--primary-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.4);
    text-decoration: none;
}

/* === Detail View === */
.detail-view-container {
    max-width: 800px;
    margin: 0 auto;
}

.detail-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--border-card);
}

.detail-card-header {
    padding: 16px 20px;
    background-color: var(--bg-card-header);
    color: var(--text-card-header);
    border-bottom: 1px solid var(--border);
}

.detail-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0;
    letter-spacing: -0.2px;
}

.detail-card-body {
    padding: 20px;
}

.detail-item {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}

.detail-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 0.775rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    color: var(--text);
    font-weight: 500;
    font-size: 1rem;
}

.detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

/* === Sticky Header === */
.card-header.sticky-header {
    position: sticky;
    top: 57px; /* below the navbar */
    z-index: 50;
    background-color: var(--bg-card-header);
    box-shadow: var(--shadow-sm);
    margin: 0;
    padding: 14px 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* === Compact Mobile Cards === */
.mobile-card {
    border: 1px solid var(--border-card);
    border-radius: 14px;
    margin-bottom: 10px;
    background-color: var(--bg-card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.2s ease;
}

.mobile-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    background-color: var(--bg-card-header);
    gap: 8px;
}

.mobile-card-date {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.mobile-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.mobile-card-content,
.mobile-card-body {
    padding: 12px 14px;
}

.mobile-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.mobile-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.mobile-card-grid-item {
    display: flex;
    flex-direction: column;
}

.grid-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.grid-value {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.mobile-card-notes {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.mobile-card-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 3px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mobile-card-value {
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 500;
}

.mobile-card-item {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}

/* Mobile card row layout */
.mobile-card-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}
.mobile-card-row:last-child {
    margin-bottom: 0;
}

/* === Mobile Responsive === */
@media (max-width: 770px) {
    .data-card {
        border-radius: 14px;
        margin: 0 -8px 16px -8px;
        width: calc(100% + 16px);
    }

    .mobile-list-view {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .data-view-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .data-table-container {
        border-radius: 10px;
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
}

@media (max-width: 576px) {
    .detail-actions,
    .form-actions {
        flex-direction: column;
    }

    .detail-actions .btn,
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 380px) {
    .data-card {
        border-radius: 12px;
        margin: 0 -12px 16px -12px;
        width: calc(100% + 24px);
    }

    .header-actions {
        margin-top: 10px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .header-btn {
        flex: 1;
        min-width: 100px;
        justify-content: center;
    }

    .form-card {
        border-radius: 14px;
        margin: 0 -8px 16px -8px;
    }

    .mobile-card-header {
        padding: 8px 10px;
    }

    .mobile-card-content,
    .mobile-card-body {
        padding: 10px;
    }
}

@media (max-width: 767px) {
    .form-card {
        border-radius: 14px;
        margin-bottom: 14px;
    }

    .form-card-header {
        padding: 12px 14px;
    }

    .form-card-body {
        padding: 16px 14px;
    }

    .card-body {
        padding: 14px;
    }
}

/* === Custom SVG Icon wrapper === */
.custom-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
}

.custom-icon svg {
    width: 100%;
    height: 100%;
}

/* === Quick Add Button (category colors via .data-card context class) === */
.quick-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    border-radius: 24px;
    padding: 0.5rem 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    gap: 5px;
    background-color: var(--primary);
    box-shadow: 0 1px 3px rgba(var(--primary-rgb), 0.3);
}

.quick-add-btn:hover,
.quick-add-btn:focus {
    transform: translateY(-2px);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
}

.quick-add-btn:active {
    transform: translateY(0);
}

.data-card.feeding-list .quick-add-btn {
    background-color: var(--feeding-color);
    box-shadow: 0 1px 3px rgba(var(--feeding-color-rgb), 0.3);
}
.data-card.feeding-list .quick-add-btn:hover {
    box-shadow: 0 4px 12px rgba(var(--feeding-color-rgb), 0.4);
}

.data-card.diaper-list .quick-add-btn {
    background-color: var(--diaper-color);
    box-shadow: 0 1px 3px rgba(var(--diaper-color-rgb), 0.3);
}
.data-card.diaper-list .quick-add-btn:hover {
    box-shadow: 0 4px 12px rgba(var(--diaper-color-rgb), 0.4);
}

.data-card.pump-list .quick-add-btn {
    background-color: var(--pump-color);
    box-shadow: 0 1px 3px rgba(var(--pump-color-rgb), 0.3);
}
.data-card.pump-list .quick-add-btn:hover {
    box-shadow: 0 4px 12px rgba(var(--pump-color-rgb), 0.4);
}

/* === Diaper type badges === */
.diaper-type {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.diaper-wet {
    color: var(--primary);
    font-weight: 500;
}

.diaper-solid {
    color: var(--weight-color);
    font-weight: 500;
}

/* === Stool color indicator === */
.diaper-color-indicator {
    display: inline-block;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

.stool-tiny   { width: 8px;  height: 8px; }
.stool-small  { width: 12px; height: 12px; }
.stool-medium { width: 16px; height: 16px; }
.stool-large  { width: 20px; height: 20px; }
.stool-giant  { width: 24px; height: 24px; }

/* === Record section title icon === */
.record-title-icon {
    color: var(--primary);
    font-size: 1.2rem;
}

/* === Striped tables === */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bg-table-stripe);
}
.table-striped tbody tr:nth-of-type(even) {
    background-color: transparent;
}
.table-hover tbody tr:hover {
    background-color: var(--bg-table-hover);
    color: var(--text);
}
