/* css/style.css - Premium Mobile PWA Styles for Milk Collection App */

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

/* ===== FORCE LIGHT MODE — ignore device dark mode ===== */
html {
    color-scheme: only light;
}

:root {
    color-scheme: only light;
    --primary: #004d40;
    --primary-light: #00796b;
    --primary-xlight: #e0f2f1;
    --accent: #2e7d32;
    --accent-light: #e8f5e9;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --text-main: #263238;
    --text-muted: #546e7a;
    --border: #e0e0e0;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.1);
    --radius: 16px;
    --font: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font);
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

/* Mobile Viewport Wrapper */
.app-container {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.08);
}

/* Header */
.app-header {
    background-color: var(--primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
}

.header-subtitle {
    font-size: 11px;
    opacity: 0.8;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: var(--transition);
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Main Content Area */
.app-content {
    flex: 1;
    padding: 16px;
    padding-bottom: 90px; /* Space for navbar */
    overflow-y: auto;
}

/* Screen Transitions */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* Custom Cards */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: var(--transition);
}

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

/* Quick Actions Button Bar */
.action-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.action-btn {
    background-color: var(--accent-light);
    color: var(--accent);
    border: 1px solid rgba(46, 125, 50, 0.2);
    padding: 10px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn:hover {
    background-color: var(--accent);
    color: white;
}

/* Grid Cards (Dashboard) */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.grid-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 8px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.01);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

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

.grid-card-icon {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 8px;
}

.grid-card-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.2;
}

/* Stats Footer Panel */
.stats-summary-bar {
    background: var(--card-bg);
    border-radius: var(--radius);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 12px 8px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stats-item {
    text-align: center;
    position: relative;
}

.stats-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 15%;
    height: 70%;
    width: 1px;
    background-color: var(--border);
}

.stats-icon {
    font-size: 16px;
    margin-bottom: 4px;
}

.stats-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stats-value {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
}

/* Forms */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background-color: #fafafa;
    font-size: 14px;
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px var(--primary-xlight);
}

.select-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23546e7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Radio Toggles / Buttons Groups */
.btn-toggle-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-toggle {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    background-color: #fafafa;
    border: 1px solid var(--border);
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    font-size: 13px;
    transition: var(--transition);
}

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

/* Save / Submit Buttons */
.submit-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-weight: 600;
    font-size: 15px;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0, 77, 64, 0.2);
}

.submit-btn:hover {
    background-color: var(--primary-light);
}

/* Switch styling */
.switch-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Entries List Items */
.list-section-title {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.entry-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.entry-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.entry-card-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.entry-card-date {
    color: var(--text-muted);
}

.entry-card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    text-align: center;
}

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

.entry-grid-label {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
}

.entry-grid-val {
    font-weight: 600;
}

.entry-grid-val.highlight {
    color: #c62828;
}

.entry-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 8px;
}

.entry-total {
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
}

.entry-actions {
    display: flex;
    gap: 6px;
}

.action-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.action-icon.whatsapp { background-color: #e8f5e9; color: #2e7d32; }
.action-icon.sms { background-color: #fff3e0; color: #ef6c00; }
.action-icon.print { background-color: #e3f2fd; color: #1565c0; }
.action-icon.edit { background-color: #f3e5f5; color: #6a1b9a; }
.action-icon.delete { background-color: #ffebee; color: #c62828; }

.action-icon:hover {
    transform: scale(1.1);
}

/* Floating Navigation Bottom */
.app-nav {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border);
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 480px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: 64px;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.nav-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

/* Specific UI Layout components (Rate grid, etc.) */
.rate-table-container {
    overflow-x: auto;
    margin-top: 12px;
}

.rate-grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: center;
}

.rate-grid-table th, .rate-grid-table td {
    border: 1px solid var(--border);
    padding: 6px 4px;
}

.rate-grid-table th {
    background-color: var(--primary-xlight);
    color: var(--primary);
    font-weight: 600;
}

.rate-grid-table tr:nth-child(even) td {
    background-color: #fafafa;
}

/* Banner image */
.dashboard-banner {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
    height: 140px;
}

.dashboard-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dashboard-banner-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    color: white;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

/* General Layout helpers */
.text-center { text-align: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mr-8 { margin-right: 8px; }
.gap-8 { gap: 8px; }
.badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}
.badge.primary { background-color: var(--primary-xlight); color: var(--primary); }
.badge.success { background-color: var(--accent-light); color: var(--accent); }

/* Quick Filter Button Bar */
.filter-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
    scrollbar-width: none; /* Firefox */
}

.filter-tabs::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.filter-tab {
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background-color: white;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.filter-tab.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Detail Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th, .data-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
}

.data-table td {
    color: var(--text-main);
}

.table-scrollable {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 450px;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
}

/* Rate Chart Matrix Table */
.rate-grid-table {
    border-collapse: collapse;
    font-size: 11px;
    white-space: nowrap;
    min-width: 100%;
}

.rate-grid-table th,
.rate-grid-table td {
    padding: 5px 8px;
    text-align: center;
    border: 1px solid #ddd;
    min-width: 45px;
}

.rate-grid-table th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 10px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.rate-grid-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background-color: var(--primary);
}

.rate-grid-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: #e8f5e9;
    font-weight: 700;
    font-size: 11px;
}

.rate-grid-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.rate-grid-table tbody tr:hover {
    background-color: #e3f2fd;
}

