html {
    box-sizing: border-box;
    font-size: 16px;
    scroll-behavior: smooth;
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    margin: 0;
    padding: 2%;
}

.container {
    max-width: 50em;
    width: 100%;
    margin: 2em auto;
    background: #ffffff;
    border-radius: 1.25em;
    box-shadow: 0 1.25em 3em rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: #fff;
    padding: 2em;
    text-align: center;
}

.header h1 {
    margin: 0 0 0.25em 0;
    font-size: 2em;
}

.header p {
    margin: 0;
    opacity: 0.9;
}

.form-container {
    padding: 1em;
}

.edit-notice {
    color: #555;
    background: #f0f0f0;
    padding: 0.8em;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 1.5em;
}

.section {
    margin-bottom: 2.5em;
    padding: 1.5em;
    background: #fdfdfd;
    border-radius: 0.8em;
    border-left: 0.3em solid #4285f4;
}

.section-title {
    font-size: 1.2em;
    color: #333;
    margin: 0 0 1em 0;
    display: flex;
    align-items: center;
    gap: 0.5em;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5em;
}

.section-number {
    background: #4285f4;
    color: white;
    border-radius: 50%;
    width: 1.5em;
    height: 1.5em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
}

.form-group {
    margin-bottom: 1.5em;
    position: relative;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
}

.form-row .form-group {
    flex: 1 1 48%;
    min-width: 0;
}

label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #555;
}

label .required {
    color: #e74c3c;
    margin-left: 2px;
}
.required {
    color: #e74c3c;}
input,
select {
    width: 100%;
    padding: 0.75em 1em;
    border: 1px solid #dcdcdc;
    border-radius: 0.5em;
    font-size: 1em;
    background: #fff;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus,
select:focus {
    border-color: #4285f4;
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

input:invalid:not(:placeholder-shown):not(:focus),
select:invalid:not(:focus) {
    /* border-color: #e74c3c; */
}

.error-message {
    color: #e74c3c;
    font-size: 0.875em;
    margin-top: 0.4em;
    min-height: 1em;
    display: none;
}

.char-counter {
    font-size: 0.8em;
    color: #888;
    text-align: right;
    position: absolute;
    bottom: -1.2em;
    right: 0.2em;
}

.final-submit-button-container {
    text-align: center;
    margin-top: 2em;
}

.submit-btn {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: #fff;
    padding: 1em 3em;
    border: none;
    border-radius: 2em;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.7em 1.5em rgba(0, 0, 0, 0.2);
}

.attributes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1em 2em;
}

.attribute-category h4 {
    margin-top: 0;
    margin-bottom: 0.8em;
    color: #4285f4;
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 0.75em;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.75em;
    width: 1.2em;
    height: 1.2em;
    accent-color: #34a853;
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: 500;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5em;
}

.photo-category {
    background: #f9f9f9;
    padding: 1em;
    border-radius: 8px;
}

.photo-category h4 {
    margin-top: 0;
    margin-bottom: 1em;
}

.file-input {
    display: none;
}

.file-input-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    width: 100%;
    padding: 1em;
    background: #fff;
    border: 2px dashed #dcdcdc;
    border-radius: 8px;
    cursor: pointer;
}

.existing-files-grid,
.existing-file {
    margin-bottom: 1rem;
}

.existing-file {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    display: inline-block;
}

.existing-preview-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    display: block;
}

.existing-file-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(248, 249, 250, 0.95);
    padding: 4px;
    font-size: 0.8em;
}

.replace-btn {
    background: none;
    border: 1px solid #007bff;
    color: #007bff;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
}

.remove-label {
    cursor: pointer;
    margin: 0;
}

.image-preview,
.video-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.image-preview img,
.video-preview video {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.file-error {
    color: #e74c3c;
    font-size: 0.875em;
    margin-top: 0.5rem;
    min-height: 1em;
}

/* Hide "Upload More" buttons by default in edit mode; JS will show them if needed */
.edit-mode .photo-category .file-input-button {
    display: none;
}
.helper-text {
    font-size: 13px;
    color: #777;
    margin-top: 4px;
}

.how-to-get-coordinates {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.5;
}


/* Preview items styling */
.preview-item {
    position: relative;
    display: inline-block;
    margin: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    background: white;
}

.media-container {
    width: 100px;
    height: 100px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-container img,
.media-container video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.remove-preview-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ff4444;
    color: white;
    border: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
}

.remove-preview-btn:hover {
    background: #cc0000;
}

/* Validation styling */
.invalid {
    border-color: #ff4444 !important;
}

.error-message {
    color: #ff4444;
    font-size: 0.85em;
    margin-top: 5px;
    display: none;
}

.char-counter {
    font-size: 0.8em;
    color: #666;
    text-align: right;
    margin-top: 2px;
}

.char-counter.near-limit {
    color: #ff9800;
}

.char-counter.over-limit {
    color: #ff4444;
    font-weight: bold;
}

/* Working Hours Section Styles */
.working-hours-section {
    margin-top: 20px;
}

.working-hours-section .field-hint {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

.working-hours-container {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
}

/* Apply to All Row */
.apply-all-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    background: #e3f2fd;
    border-radius: 6px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.apply-all-btn {
    background: #1976d2;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.apply-all-btn:hover {
    background: #1565c0;
}

.apply-all-times {
    display: flex;
    align-items: center;
    gap: 8px;
}

.apply-all-times input[type="time"] {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

/* Day Hours Row */
.day-hours-row {
    display: flex;
    flex-direction: column;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
}

.day-hours-row:last-child {
    border-bottom: none;
}

.day-hours-row:hover {
    background: #fff;
}

.day-hours-row .day-label {
    font-weight: 600;
    color: #333;
    min-width: 100px;
    margin-bottom: 8px;
    font-size: 14px;
}

.day-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Checkbox Toggles */
.closed-toggle,
.hours24-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    user-select: none;
}

.closed-toggle input,
.hours24-toggle input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.closed-toggle span,
.hours24-toggle span {
    white-space: nowrap;
}

/* Time Inputs */
.time-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-inputs input[type="time"] {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    min-width: 120px;
}

.time-inputs input[type="time"]:focus {
    border-color: #1976d2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.time-separator {
    color: #666;
    font-size: 13px;
}

/* Add/Remove Slot Buttons */
.add-slot-btn {
    background: transparent;
    color: #1976d2;
    border: 1px dashed #1976d2;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.add-slot-btn:hover {
    background: #e3f2fd;
}

.remove-slot-btn {
    background: #ff5252;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-slot-btn:hover {
    background: #d32f2f;
}

/* Second Slot */
.second-slot {
    margin-top: 8px;
    padding-left: 100px;
}

.second-slot .time-inputs {
    background: #fff3e0;
    padding: 8px 12px;
    border-radius: 4px;
}

/* Disabled State */
.day-hours-row.is-closed .time-inputs,
.day-hours-row.is-closed .add-slot-btn,
.day-hours-row.is-closed .hours24-toggle,
.day-hours-row.is-closed .second-slot {
    display: none !important;
}

.day-hours-row.is-24hrs .time-inputs,
.day-hours-row.is-24hrs .add-slot-btn,
.day-hours-row.is-24hrs .second-slot {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .day-hours-row {
        padding: 10px;
    }

    .day-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .time-inputs {
        flex-wrap: wrap;
    }

    .time-inputs input[type="time"] {
        min-width: 100px;
    }

    .second-slot {
        padding-left: 0;
    }

    .apply-all-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Working Hours Error Messages */
#workingHoursError {
    color: #d32f2f;
    font-size: 13px;
    margin-top: 10px;
    padding: 10px;
    background: #ffebee;
    border-radius: 4px;
    display: none;
}

#workingHoursError div {
    margin-bottom: 5px;
}

#workingHoursError div:last-child {
    margin-bottom: 0;
}

/* Invalid time input highlight */
.day-hours-row input[type="time"].is-invalid,
.day-hours-row input[type="time"][style*="border-color: rgb(255, 82, 82)"] {
    border-color: #ff5252 !important;
    background-color: #fff8f8;
}

/* Loading spinner for submit button */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Copy hours button styling */
.copy-hours-btn:hover {
    background: #e0e0e0 !important;
}