/* Station Clock Mobile CSS - Compatible with older browsers and improved quantity handling */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: #f5f5f5;
    color: #000000;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* Header */
.app-header {
    background-color: #00a3ff;
    color: #ffffff;
    padding: 15px;
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-header h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 600;
}

.app-header h1 img {
    height: 30px;
    width: auto;
    vertical-align: middle;
    margin-right: 10px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.header-info {
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.9;
}

.header-info span {
    margin: 0 10px;
}

/* Main Container */
.main-container {
    padding: 80px 15px 30px;
    max-width: 600px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.card.hidden {
    display: none;
}

.card h2, .card h3 {
    color: #000000;
    margin-bottom: 15px;
    font-size: 18px;
}

/* Help Text */
.help-text {
    font-size: 14px;
    color: #6d6d6d;
    font-style: italic;
    margin-bottom: 10px;
}

/* Input Groups */
.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    color: #6d6d6d;
    font-size: 14px;
    margin-bottom: 5px;
    font-weight: 500;
}

.input-group input[type="text"],
.input-group input[type="tel"],
.input-group input[type="number"],
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* CRITICAL: Better number input styling for quantity */
.input-group input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
    text-align: left;
}

.input-group input[type="number"]::-webkit-outer-spin-button,
.input-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: #00a3ff;
    box-shadow: 0 0 0 3px rgba(0, 163, 255, 0.1);
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    width: 100%;
    margin-top: 10px;
}

.btn-primary {
    background-color: #00a3ff;
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0090e0;
    transform: translateY(-1px);
}

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

.btn-secondary {
    background-color: #6d6d6d;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #5a5a5a;
}

.btn-switch {
    background-color: #ff6b35;
    color: #ffffff;
}

.btn-switch:hover:not(:disabled) {
    background-color: #e55a2b;
    transform: translateY(-1px);
}

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

.btn-large {
    padding: 20px 30px;
    font-size: 18px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn svg {
    margin-left: 8px;
}

.btn-icon {
    margin-left: 10px;
}

/* Employee Section */
.employee-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}

.emp-id {
    color: #6d6d6d;
    font-size: 14px;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
}

.status-badge.clocked-in {
    background-color: #28a745;
    color: white;
}

.status-badge.clocked-out {
    background-color: #6d6d6d;
    color: white;
}

.gift-card-message {
    background-color: #e3f2fd;
    border-left: 4px solid #00a3ff;
    padding: 10px;
    margin: 10px 0;
    font-size: 14px;
    border-radius: 4px;
}

.emp-notes {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 10px;
    margin: 10px 0;
    font-size: 14px;
    border-radius: 4px;
}

/* Station Section */
.repair-checkbox {
    margin-top: 10px;
    display: flex;
    align-items: center;
}

.repair-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    cursor: pointer;
}

.repair-checkbox label {
    margin: 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.station-info {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.station-info h4 {
    margin-bottom: 8px;
    color: #000000;
    font-size: 16px;
}

.work-instruction {
    margin-top: 10px;
}

/* Clock Out Section */
.current-station {
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 16px;
}

.current-station strong {
    color: #00a3ff;
}

/* CRITICAL: Improved Quantity Group Styling */
#quantityGroup {
    background-color: #fff8e1;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

#quantityGroup.hidden {
    display: none;
}

#quantityGroup label {
    color: #e65100;
    font-weight: 600;
    font-size: 15px;
}

#quantityInput {
    border-color: #ffc107 !important;
    font-weight: 600;
    font-size: 18px;
    text-align: center;
}

#quantityInput:focus {
    border-color: #ff9800 !important;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2) !important;
}

/* Feeling Section */
.feeling-section {
    margin-top: 20px;
}

.feeling-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.feeling-options {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.feeling-option {
    flex: 1;
    text-align: center;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.feeling-option:hover {
    border-color: #00a3ff;
    background-color: #f0f8ff;
}

.feeling-option.selected {
    border-color: #00a3ff;
    background-color: #e3f2fd;
}

.feeling-option input[type="radio"] {
    display: none;
}

.feeling-option img {
    width: 40px;
    height: 40px;
    margin-bottom: 5px;
}

.feeling-option span {
    display: block;
    font-size: 14px;
    color: #6d6d6d;
}

/* Messages */
.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: none;
    padding: 8px 12px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

.error-message.show {
    display: block;
}

.action-message {
    text-align: center;
    margin-top: 15px;
    font-size: 16px;
    font-weight: 500;
}

.action-message.success {
    color: #28a745;
}

.action-message.error {
    color: #dc3545;
}

/* Schedule Section */
.schedule-content {
    max-height: 300px;
    overflow-y: auto;
}

.schedule-item {
    position: relative;
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.schedule-item:last-child {
    border-bottom: none;
}

.schedule-item .station-code {
    font-weight: 600;
    color: #00a3ff;
}

.schedule-item .quantity {
    color: #6d6d6d;
    font-size: 14px;
}

/* Clickable Schedule Items */
.schedule-item.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.schedule-item.clickable:hover {
    background-color: #f0f8ff;
    border-left: 3px solid #00a3ff;
    padding-left: 7px;
}

.schedule-item.clickable:active {
    background-color: #e3f2fd;
}

.schedule-item.selected {
    background-color: #e3f2fd;
    border-left: 3px solid #00a3ff;
    padding-left: 7px;
}

/* Queue Popup */
.queue-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.queue-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.queue-list {
    margin: 20px 0;
}

.queue-item {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.queue-item:hover {
    border-color: #00a3ff;
    background-color: #f0f8ff;
}

.queue-item .queue-station {
    font-weight: 600;
    color: #000000;
    font-size: 16px;
}

.queue-item .queue-desc {
    color: #6d6d6d;
    font-size: 14px;
    margin-top: 5px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6d6d6d;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

/* Indirect Station Fields Section */
.indirect-fields-section {
    margin: 20px 0;
    padding: 15px;
    background-color: #f0f8ff;
    border: 2px solid #00a3ff;
    border-radius: 6px;
}

.indirect-fields-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #00a3ff;
    font-size: 16px;
}

.indirect-fields-section table {
    width: 100%;
}

.indirect-fields-section td {
    padding: 8px 5px;
    vertical-align: middle;
}

.indirect-fields-section td:first-child {
    font-weight: 600;
    width: 35%;
}

.indirect-fields-section .indirect_input_class {
    width: 100%;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
}

.indirect-fields-section .indirect_input_class:focus {
    outline: none;
    border-color: #00a3ff;
}

.indirect-fields-section textarea {
    width: 100%;
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #00a3ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    -webkit-animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@-webkit-keyframes spin {
    0% { -webkit-transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); }
}

/* Message Popup */
.message-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 400;
    text-align: center;
    min-width: 250px;
    max-width: 400px;
}

.message-popup.hidden {
    display: none;
}

#messageIcon {
    font-size: 48px;
    margin-bottom: 15px;
}

#messageIcon.success {
    color: #28a745;
}

#messageIcon.error {
    color: #dc3545;
}

#messageIcon.warning {
    color: #ffc107;
}

#messageText {
    font-size: 16px;
    color: #000000;
    margin-bottom: 10px;
}

/* Message Details for Station Performance */
.message-details {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.details-table-compact {
    width: 100%;
    margin-bottom: 10px;
}

.details-table-compact td {
    padding: 5px;
    font-size: 14px;
}

.details-table-compact td:first-child {
    text-align: right;
    color: #6d6d6d;
    padding-right: 10px;
}

.details-table-compact .metric-value {
    font-weight: bold;
    font-size: 16px;
}

.metric-value.good {
    color: #28a745;
}

.metric-value.bad {
    color: #dc3545;
}

.performance-text {
    font-size: 14px;
    margin-top: 10px;
}

.performance-text .good {
    color: #28a745;
    font-weight: bold;
}

.performance-text .bad {
    color: #dc3545;
    font-weight: bold;
}

/* Break Timer */
.break-timer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.break-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.break-time {
    font-size: 48px;
    font-weight: bold;
    color: #dc3545;
    margin: 20px 0;
    font-family: monospace;
}

/* Survey Questions */
.survey-question {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.survey-question label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    margin-right: 5px;
}

/* Station Schedule */
.station-schedule-content {
    overflow-x: auto;
}

.station-schedule-content table {
    width: 100%;
    border-collapse: collapse;
}

.station-schedule-content th,
.station-schedule-content td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.station-schedule-content th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Indirect Station Fields */
.indirect-field {
    margin-bottom: 15px;
}

.indirect-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.indirect-field select,
.indirect-field input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
}

/* Station Section Error States */
.card.has-errors {
    border: 2px solid #dc3545;
}

.indirect-fields-section.valid {
    border-color: #28a745;
    background-color: #d4edda;
}

/* Responsive Design */
@media (max-width: 480px) {
    .main-container {
        padding: 70px 10px 20px;
    }
    
    .card {
        padding: 15px;
    }
    
    .btn {
        font-size: 14px;
        padding: 10px 20px;
    }
    
    .feeling-option img {
        width: 30px;
        height: 30px;
    }
    
    .modal-content {
        margin: 10px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="tel"],
    input[type="number"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Android Specific Fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select {
        background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2714%27%20height%3D%278%27%20viewBox%3D%270%200%2014%208%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%3Cpath%20d%3D%27M1%201l6%206%206-6%27%20stroke%3D%27%236d6d6d%27%20stroke-width%3D%272%27%20fill%3D%27none%27%20fill-rule%3D%27evenodd%27%2F%3E%3C%2Fsvg%3E');
        background-repeat: no-repeat;
        background-position: right 10px center;
        padding-right: 30px;
    }
}