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;
}

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;
}