/* Fresh Production Tracker - Touch-Optimized Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    font-size: 18px;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: #2c3e50;
    color: white;
    padding: 12px 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 15px;
}

.header-title {
    display: flex;
    align-items: baseline;
    gap: 15px;
    flex-wrap: wrap;
}

header h1 {
    font-size: 26px;
    margin: 0;
    line-height: 1.2;
}

.date-display {
    font-size: 18px;
    color: #ecf0f1;
    margin: 0;
    font-weight: 500;
    opacity: 0.9;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.user-name {
    font-size: 16px;
    color: #ecf0f1;
    font-weight: 500;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
}

.logout-btn:hover,
.logout-btn:active {
    background: #c0392b;
}

/* Navigation */
nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

nav a {
    background: #34495e;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 8px;
    font-size: 18px;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-weight: 500;
}

nav a:hover, nav a:active {
    background: #1abc9c;
}

nav a.active {
    background: #16a085;
}

/* Filter Section */
.filter-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filter-form {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 220px;
    flex: 1;
}

.filter-group label {
    font-weight: 600;
    font-size: 18px;
    color: #2c3e50;
}

.filter-group select {
    padding: 18px 20px;
    font-size: 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    min-height: 60px;
    background: white;
    cursor: pointer;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232c3e50' 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 15px center;
    background-size: 20px;
    padding-right: 50px;
}

.filter-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-clear {
    background: #95a5a6;
    color: white;
    padding: 18px 32px;
    text-decoration: none;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 600;
    min-height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-clear:hover,
.btn-clear:active {
    background: #7f8c8d;
}

/* Info Message */
.info-message {
    background: #3498db;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 18px;
    text-align: center;
    font-weight: 500;
}

/* Tracker Table */
.tracker-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-top: 30px;
    border-collapse: collapse;
}

.tracker-table thead {
    background: #2c3e50;
    color: white;
}

.tracker-table th {
    padding: 20px 15px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
}

.tracker-table tbody tr {
    border-bottom: 2px solid #ecf0f1;
}

.tracker-table tbody tr:last-child {
    border-bottom: none;
}

.tracker-table tbody tr:hover {
    background: #f8f9fa;
}

.tracker-table td {
    padding: 15px;
    vertical-align: middle;
    font-size: 18px;
}

.tracker-table .img-cell {
    width: 100px;
    text-align: center;
}

.tracker-table .item-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.tracker-table .item-thumb-placeholder {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ecf0f1;
    border-radius: 8px;
    font-size: 36px;
}

.tracker-table .item-name-cell {
    font-size: 22px;
    font-weight: 600;
    color: #2c3e50;
}

.tracker-table .qty-cell {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    min-width: 80px;
}

.tracker-table .action-cell {
    text-align: right;
    min-width: 180px;
}

/* Counter Controls */
.counter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

.counter-btn {
    width: 60px;
    height: 60px;
    border: none;
    background: #3498db;
    color: white;
    font-size: 32px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.counter-btn:active {
    transform: scale(0.95);
    background: #2980b9;
}

.counter-btn.minus {
    background: #e74c3c;
}

.counter-btn.minus:active {
    background: #c0392b;
}

.counter-display {
    display: inline-block;
    min-width: 60px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
}

/* Admin Forms */
.admin-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.admin-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 28px;
}

/* Date Filter */
.date-filter-form,
.week-selector {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.date-input-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.date-input-group input[type="date"] {
    flex: 1;
    min-width: 200px;
}

.date-input-group .btn {
    flex-shrink: 0;
}

/* Weekly Targets Grid */
.weekly-targets-grid {
    overflow-x: auto;
    margin-top: 20px;
}

.targets-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 800px;
}

.targets-table th {
    background: #34495e;
    color: white;
    padding: 15px 10px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

.targets-table th:first-child {
    text-align: left;
    min-width: 180px;
}

.targets-table td {
    padding: 10px;
    border: 1px solid #ecf0f1;
    text-align: center;
}

.targets-table td:first-child {
    text-align: left;
    font-weight: 600;
    background: #f8f9fa;
}

.target-input {
    width: 70px;
    padding: 10px 8px;
    font-size: 18px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 6px;
    min-height: 44px;
}

.target-input:focus {
    outline: none;
    border-color: #3498db;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 18px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group select {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 8px;
    min-height: 54px;
}

.form-group input[type="file"] {
    padding: 12px;
}

.btn {
    background: #27ae60;
    color: white;
    padding: 18px 40px;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    min-height: 60px;
    transition: all 0.2s;
}

.btn:active {
    transform: scale(0.98);
    background: #229954;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:active {
    background: #c0392b;
}

/* Items List (Admin) */
.items-list {
    margin-top: 30px;
}

.items-list table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.items-list td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.items-list th {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #ecf0f1;
    background: #34495e;
    color: white;
    font-size: 18px;
}

.items-list img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.items-list .actions {
    display: flex;
    gap: 10px;
}

.items-list .actions button {
    padding: 10px 20px;
    font-size: 16px;
    min-height: 44px;
}

/* Reports */
.report-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.report-table table {
    width: 100%;
    border-collapse: collapse;
}

.report-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.report-table th {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #ecf0f1;
    background: #2c3e50;
    color: white;
    font-weight: 600;
}

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

/* Messages */
.message {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 18px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Labor Calculator */
.labor-calculator {
    margin-top: 20px;
}

.labor-calculator table {
    font-size: 16px;
}

.labor-calculator td small {
    font-size: 13px;
}

/* Category Headers */
.category-header td {
    background: #3498db !important;
    color: white !important;
    font-weight: bold;
    font-size: 18px;
    padding: 15px !important;
    text-align: left;
    border: none !important;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin: 20px 0 0 0;
    border-bottom: 3px solid #34495e;
}

.tab-btn {
    background: #ecf0f1;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
    color: #2c3e50;
}

.tab-btn:hover {
    background: #d5d8dc;
}

.tab-btn.active {
    background: #34495e;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Input fields for scanout and inventory */
.scanout-input,
.inventory-input {
    width: 80px;
    text-align: center;
    font-size: 18px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
}

.scanout-input:focus,
.inventory-input:focus {
    outline: none;
    border-color: #3498db;
}

/* Responsive */
@media (max-width: 900px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .date-display {
        font-size: 14px;
    }
    
    .scanout-input,
    .inventory-input {
        width: 70px;
        font-size: 16px;
        padding: 6px;
    }
    
    nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    nav a {
        padding: 10px 15px;
        font-size: 16px;
    }
    
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .filter-group select {
        padding: 14px 16px;
        font-size: 18px;
        min-height: 54px;
        padding-right: 45px;
    }
    
    .btn-clear {
        padding: 14px 28px;
        font-size: 18px;
        min-height: 54px;
    }
    
    .items-list,
    .tracker-table {
        overflow-x: auto;
        display: block;
        font-size: 14px;
    }
    
    .tracker-table th,
    .tracker-table td {
        font-size: 14px;
        padding: 8px 5px;
    }
    
    .tracker-table .item-thumb,
    .tracker-table .item-thumb-placeholder {
        width: 50px;
        height: 50px;
    }
    
    .img-cell {
        width: 55px;
    }
    
    .item-name-cell {
        font-size: 15px;
        min-width: 100px;
    }
    
    .qty-cell {
        font-size: 14px;
    }
    
    .counter-btn {
        width: 45px;
        height: 45px;
        font-size: 24px;
    }
    
    .counter-controls {
        gap: 5px;
    }
    
    .counter-display {
        font-size: 20px;
        min-width: 50px;
    }
    
    .category-header td {
        font-size: 16px !important;
        padding: 10px !important;
    }
    
    /* Tighter table layout */
    .tracker-table {
        min-width: 100%;
    }
    
    /* Make Type column narrower */
    .tracker-table td:nth-child(3) {
        font-size: 13px;
    }
    
    /* Time column compact */
    .tracker-table td small {
        font-size: 11px;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 20px;
    }
    
    .date-display {
        font-size: 12px;
    }
    
    nav a {
        padding: 8px 12px;
        font-size: 14px;
    }
    .counter-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .tracker-table th,
    .tracker-table td {
        font-size: 13px;
        padding: 6px 4px;
    }
    
    .item-name-cell {
        font-size: 14px;
    }
}
