/* Base styling */

:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #4caf50;
    --error-color: #f44336;
    --warning-color: #ff9800;
    --text-color: #000000;
    --light-text: #fff;
    --border-color: #ddd;
    --background-color: #ffffff;
    --card-background: #ffffff;
    --mobile-padding: 15px;
    --desktop-padding: 20px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    padding: var(--mobile-padding);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}


/* Header styling */

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
}


/* Scanner container */

.scanner-container {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: var(--mobile-padding);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

#reader {
    width: 100%;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.manual-entry {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.manual-entry input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.manual-entry input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}


/* Button styling */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    min-height: 44px;
    /* Minimum touch target size */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

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

.btn.primary {
    background-color: var(--primary-color);
    color: var(--light-text);
    box-shadow: 0 2px 4px rgba(67, 97, 238, 0.3);
}

.btn.primary:hover {
    background-color: var(--secondary-color);
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.4);
}

.btn.secondary {
    background-color: #6c757d;
    color: white;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.btn.secondary:hover {
    background-color: #5a6268;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
    min-height: 50px;
}


/* Result container */

.result-container {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: var(--mobile-padding);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    white-space: nowrap;
}

.badge.success {
    background-color: var(--success-color);
    color: white;
}

.badge.error {
    background-color: var(--error-color);
    color: white;
}

.badge.warning {
    background-color: var(--warning-color);
    color: white;
}

.detail-row {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
}

.detail-label {
    flex: 0 0 8px;
    font-weight: bold;
    color: #666;
    font-size: 0.9rem;
}

.detail-value {
    flex: 1;
    word-break: break-word;
}

.status-received {
    color: var(--success-color) !important;
    font-weight: bold;
}

.status-pending {
    color: var(--error-color) !important;
    font-weight: bold;
}


/* Action buttons */

.action-buttons {
    margin-top: 20px;
    display: flex;
    gap: 15px;
}


/* Loading state */

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* Error message */

.error-message {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(244, 67, 54, 0.1);
    border-left: 4px solid var(--error-color);
    color: var(--error-color);
}


/* Utility classes */

.hidden {
    display: none !important;
}


/* System notifications */

.system-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 20px;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    text-align: center;
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s;
    max-width: 90%;
    min-width: 300px;
    font-size: 0.95rem;
    line-height: 1.4;
}

.system-notification.success {
    background-color: var(--success-color);
    color: white;
}

.system-notification.error {
    background-color: var(--error-color);
    color: white;
}

.system-notification.warning {
    background-color: var(--warning-color);
    color: white;
}

.system-notification.info {
    background-color: var(--primary-color);
    color: white;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}


/* OC and Participant badges */

.oc-badge {
    background-color: #dc3545;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}

.participant-badge {
    background-color: #6c757d;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}


/* Badge styles for scanning pages */

.badge.oc {
    background-color: #007bff;
    color: white;
}

.badge.participant {
    background-color: #6c757d;
    color: white;
}


/* Mobile responsive styling */


/* Mobile First Approach */

@media (max-width: 480px) {
    body {
        padding: 10px;
        font-size: 16px;
        /* Prevent zoom on input focus */
    }
    .container {
        width: 100%;
        max-width: none;
    }
    /* Header adjustments */
    header {
        margin-bottom: 20px;
    }
    header h1 {
        font-size: 1.5rem;
    }
    .subtitle {
        font-size: 0.95rem;
    }
    /* Scanner container */
    .scanner-container {
        padding: 15px;
        margin-bottom: 15px;
    }
    #reader {
        height: auto !important;
        min-height: 250px;
    }
    /* Controls */
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    .manual-entry {
        flex-direction: column;
        gap: 10px;
    }
    .manual-entry input {
        min-width: auto;
        width: 100%;
        font-size: 16px;
        /* Prevent zoom */
        padding: 15px;
    }
    /* Buttons */
    .btn {
        width: 100%;
        padding: 15px;
        font-size: 1rem;
        min-height: 48px;
    }
    .btn-large {
        padding: 18px;
        font-size: 1.1rem;
        min-height: 52px;
    }
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    /* Result container */
    .result-container {
        padding: 15px;
    }
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .result-header h2 {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }
    .badge {
        margin-top: 5px;
    }
    .detail-row {
        flex-direction: column;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid #eee;
    }
    .detail-label {
        margin-bottom: 5px;
        font-size: 0.85rem;
        color: #888;
    }
    .detail-value {
        font-size: 1rem;
        font-weight: 500;
        padding-left: 0;
    }
    /* System notifications */
    .system-notification {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        transform: none;
        min-width: auto;
        font-size: 0.9rem;
        padding: 12px 15px;
    }
    /* Loading spinner */
    .loading {
        padding: 30px 0;
    }
    .spinner {
        width: 35px;
        height: 35px;
    }
    /* Error messages */
    .error-message {
        font-size: 0.9rem;
        padding: 12px;
    }
    /* Meal buttons specific */
    .meal-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    /* T-shirt and action containers */
    .tshirt-container,
    .action-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
}


/* Desktop styles */

@media (min-width: 769px) {
    body {
        padding: var(--desktop-padding);
    }
    .scanner-container,
    .result-container {
        padding: var(--desktop-padding);
        margin-bottom: 30px;
    }
    .manual-entry input:focus {
        transform: scale(1.02);
    }
    .btn:hover {
        transform: translateY(-1px);
    }
    .btn:active {
        transform: translateY(0);
    }
}


/* Large screens */

@media (min-width: 1200px) {
    .container {
        max-width: 900px;
    }
    .scanner-container,
    .result-container {
        padding: 30px;
    }
}


/* Touch device optimizations */

@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        transform: none;
        background-color: var(--primary-color);
    }
    .btn.secondary:hover {
        background-color: #6c757d;
    }
    .manual-entry input {
        font-size: 16px;
    }
}