* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin: 20px 0;
    font-size: 1.8rem;
    top: 0;
    padding: 10px 0;
}

.button-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 130px;
}

.control-button {
    padding: 15px;
    font-size: 1.1rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.control-button:hover {
    background-color: #2980b9;
}

.form-container {
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    position: relative;
}

.form-container.active {
    display: block;
}

.spz-input, .name-input {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.control-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: white;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.control-table th,
.control-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    position: relative;
}

.control-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.checkbox-container {
    display: flex;
    justify-content: center;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    border: 2px solid #3498db;
    border-radius: 3px;
    position: relative;
    outline: none;
}

input[type="checkbox"]:checked {
    background-color: #3498db;
}

.text-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.submit-button {
    width: 100%;
    padding: 15px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 0 0 20px 0;
}

.submit-button:hover {
    background-color: #219653;
}

.back-button {
    position: sticky;
    top: 0;
    z-index: 20;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #7f8c8d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.back-button:hover {
    background-color: #6c7a7d;
}

.spz-suggestions {
    list-style: none;
    margin-bottom: 15px;
}

.spz-suggestion {
    padding: 8px 12px;
    background-color: #ecf0f1;
    margin-bottom: 5px;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.spz-suggestion:hover {
    background-color: #dde4e6;
}

.search-button {
    padding: 15px;
    font-size: 1.1rem;
    background-color: #e67e22;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-button:hover {
    background-color: #d35400;
}

.search-form {
    background: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.search-form input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-result-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    background: white;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item h3 {
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.search-result-item p {
    margin: 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.no-results {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
}

.date-range-container {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.date-range-container label {
    color: #2c3e50;
    font-weight: 500;
}

.date-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.photo-icon {
    width: 24px;
    height: 24px;
    cursor: pointer;
    margin-left: 10px;
    color: #3498db;
}

.photo-icon:hover {
    color: #2980b9;
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-item .delete-photo {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-item .delete-photo:hover {
    background: rgba(255, 0, 0, 0.9);
}

#camera-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
}

#camera-modal.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#camera-preview {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    object-fit: cover;
}

.camera-controls {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 0 20px;
}

.camera-button {
    padding: 15px 30px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    min-width: 120px;
}

.capture-button {
    background-color: #27ae60;
    color: white;
}

.cancel-button {
    background-color: #e74c3c;
    color: white;
}

.protocol-note {
    font-size: 0.9em;
    color: #000000;
    margin-top: 5px;
    margin-bottom: 15px;
    padding: 0 10px;
    line-height: 1.4;
}

.suggestions-list {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 150px;
    overflow-y: auto;
    width: calc(100% - 40px);
    z-index: 1000;
    margin-top: -10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    list-style: none;
}

.suggestion-item:hover {
    background-color: #f5f5f5;
}