/* Product Tracking - Main Stylesheet */

body {
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 30px;
}

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

label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

.required::after {
    content: " *";
    color: red;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

textarea {
    height: 80px;
    resize: vertical;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.submit-btn {
    background-color: #007bff;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
}

.submit-btn:hover {
    background-color: #0056b3;
}

/* Button row for multiple buttons */
.button-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

.button-row .submit-btn {
    flex: 1;
    width: auto;
}

.generate-url-btn {
    background-color: #17a2b8;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.generate-url-btn:hover {
    background-color: #138496;
}

/* URL Display Section */
.url-display {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    border-left: 4px solid #17a2b8;
}

.url-display h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #495057;
    font-size: 18px;
}

.url-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.url-container input {
    flex: 1;
    font-family: monospace;
    font-size: 12px;
    background-color: white;
    border: 1px solid #ced4da;
    padding: 10px;
}

.copy-btn {
    background-color: #17a2b8;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.copy-btn:hover {
    background-color: #138496;
}

.url-info {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
    font-style: italic;
}

/* Responsive design for button row */
@media (max-width: 600px) {
    .button-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .button-row .submit-btn {
        width: 100%;
    }
    
    .generate-url-btn {
        width: 100%;
    }
    
    .url-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .copy-btn {
        width: 100%;
    }
}

.alert {
    padding: 15px;
    margin: 20px 0;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-col {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    h1 {
        font-size: 24px;
    }
}

/* Focus states for accessibility */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Error state styling */
.form-field-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

/* Loading state for submit button */
.submit-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* View Record Section */
.view-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.view-section h2 {
    color: #333;
    text-align: center;
    margin-bottom: 25px;
    font-size: 20px;
}

.view-form {
    max-width: 500px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-group input[type="text"] {
    flex: 1;
}

.view-btn {
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    height: 42px;
}

.view-btn:hover {
    background-color: #218838;
}

.view-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Responsive design for view section */
@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .view-btn {
        width: 100%;
    }
}

/* View Record Page Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 15px;
}

.back-btn {
    background-color: #6c757d;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}

.back-btn:hover {
    background-color: #5a6268;
    text-decoration: none;
    color: white;
}

/* Record Cards */
.records-section {
    margin-bottom: 40px;
}

.record-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.record-header h3 {
    margin: 0;
    color: #495057;
}

.record-timestamp {
    font-size: 12px;
    color: #6c757d;
}

.record-content {
    padding: 20px;
}

.field-group {
    margin-bottom: 12px;
    padding: 8px 0;
}

.field-group strong {
    display: inline-block;
    min-width: 150px;
    color: #495057;
}

/* Record Type Specific Colors */
.record-newrecord {
    border-left: 4px solid #007bff;
}

.record-manufacturingrecord {
    border-left: 4px solid #28a745;
}

.record-regularcheckrecord {
    border-left: 4px solid #ffc107;
}

.record-updaterecord {
    border-left: 4px solid #17a2b8;
}

/* Status Indicators */
.status-pass {
    color: #28a745;
    font-weight: bold;
}

.status-fail {
    color: #dc3545;
    font-weight: bold;
}

.warning {
    color: #dc3545;
    font-weight: bold;
    background-color: #f8d7da;
    padding: 8px;
    border-radius: 4px;
}

.no-records {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

/* Add Record Section */
.add-record-section {
    background-color: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin-top: 30px;
}

.add-record-section h2 {
    margin-top: 0;
    color: #333;
    text-align: center;
    margin-bottom: 25px;
}

.form-section h3 {
    color: #495057;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

/* Tab System */
.form-tabs {
    margin-top: 20px;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    color: #6c757d;
    font-size: 14px;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.tab-btn:hover {
    color: #007bff;
}

.tab-content {
    display: none;
}

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

/* Radio and Checkbox Groups */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-option input[type="radio"] {
    width: auto;
}

.radio-option label {
    margin: 0;
    font-weight: normal;
}

/* Record Type Selection */
.record-type-selection {
    margin-bottom: 30px;
}

.record-type-selection h3 {
    color: #495057;
    margin-bottom: 15px;
    text-align: center;
}

.record-type-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.record-type-btn {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 15px 20px;
    cursor: pointer;
    text-align: center;
    min-width: 180px;
    transition: all 0.3s ease;
}

.record-type-btn:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.record-type-btn.active {
    border-color: #007bff;
    background-color: #e3f2fd;
    color: #007bff;
}

.record-type-btn small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

.record-type-btn.active small {
    color: #0056b3;
}

/* Form Containers */
.form-container {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 25px;
    margin-top: 20px;
}

.form-container h3 {
    color: #495057;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.form-container h4 {
    color: #495057;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 16px;
}

/* Quality Section within Manufacturing */
.quality-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin: 20px 0;
    border-left: 4px solid #ffc107;
}

/* Device Access & Identification Section */
.device-access-section {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #007bff;
}

.device-access-section h2 {
    margin-top: 0;
    color: #333;
    text-align: center;
    margin-bottom: 25px;
}

.access-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.access-method {
    background: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.access-method h3 {
    margin-top: 0;
    color: #495057;
    margin-bottom: 15px;
    font-size: 16px;
}

/* QR Code Styles */
.qr-code-container {
    text-align: center;
}

.qr-code {
    max-width: 150px;
    height: auto;
    border: 2px solid #dee2e6;
    border-radius: 4px;
}

/* NFC Styles */
.nfc-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nfc-link {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-text {
    background-color: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
    border: 1px solid #dee2e6;
}

.copy-btn {
    background-color: #17a2b8;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    align-self: flex-start;
}

.copy-btn:hover {
    background-color: #138496;
}

/* Embedded Code Styles */
.embedded-code-section {
    background: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.embedded-code-section h3 {
    margin-top: 0;
    color: #495057;
    margin-bottom: 15px;
}

.stl-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.download-btn, .preview-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.download-btn {
    background-color: #28a745;
    color: white;
}

.download-btn:hover {
    background-color: #218838;
}

.preview-btn {
    background-color: #6c757d;
    color: white;
}

.preview-btn:hover {
    background-color: #5a6268;
}

.stl-details {
    color: #6c757d;
    font-style: italic;
}

.no-data {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Responsive Design for View Page */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header h1 {
        margin: 0;
        font-size: 24px;
    }
    
    .field-group strong {
        display: block;
        margin-bottom: 4px;
        min-width: auto;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .record-type-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .record-type-btn {
        min-width: 250px;
    }
    
    .tab-buttons {
        flex-direction: column;
    }
    
    .tab-btn {
        text-align: left;
        border-bottom: 1px solid #dee2e6;
    }
    
    .tab-btn.active {
        background-color: #e3f2fd;
    }
    
    /* Mobile responsive for device access section */
    .access-methods {
        grid-template-columns: 1fr;
    }
    
    .qr-code {
        max-width: 120px;
    }
    
    .stl-actions {
        flex-direction: column;
    }
    
    .download-btn, .preview-btn {
        width: 100%;
    }
}

/* Simple Statistics Page Styles */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background-color: #007bff;
    color: white;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: bold;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:hover {
    background-color: #e9ecef;
}

td a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}

td a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Login Page Styles */
.login-form-section {
    max-width: 400px;
    margin: 30px auto;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.login-info {
    text-align: center;
    margin-top: 20px;
}

.form-actions {
    margin-top: 25px;
}

/* Navigation Buttons */
.nav-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.logout-btn {
    background-color: #dc3545;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background-color: #c82333;
    text-decoration: none;
    color: white;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header h1 {
    margin: 0;
    text-align: left;
}

@media (max-width: 768px) {
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .nav-buttons {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .logout-btn, .back-btn {
        text-align: center;
        width: 100%;
    }
}