/* Submit Form Styles */

.form-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.section-header {
    margin-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 1rem;
}

.section-header h2 {
    margin: 0;
    color: #233d3d;
    font-size: 1.8rem;
    font-weight: 700;
}

.info-message {
    background: #f5f9ff;
    border-left: 4px solid #298e8e;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
}

.info-message p {
    margin: 0;
    line-height: 1.6;
    color: #333;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #233d3d;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Manrope', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #298e8e;
    box-shadow: 0 0 0 3px rgba(41, 142, 142, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group small {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #666;
}

.char-counter {
    display: block;
    text-align: right;
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

.char-counter.warning {
    color: #e67e22;
    font-weight: 600;
}

.char-counter.danger {
    color: #e74c3c;
    font-weight: 600;
}

/* Address Search Styles */
.address-results {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #d0d0d0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: white;
    display: none;
}

.address-results.show {
    display: block;
}

.address-result-item {
    padding: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.address-result-item:last-child {
    border-bottom: none;
}

.address-result-item:hover {
    background: #f5f9ff;
}

.address-result-name {
    font-weight: 600;
    color: #233d3d;
    margin-bottom: 0.25rem;
}

.address-result-details {
    font-size: 0.85rem;
    color: #666;
}

/* Readonly location input fields */
input[readonly],
textarea[readonly] {
    background-color: #f8f9fa;
    cursor: default;
}

/* Location section - removed map grid */
.location-fields-wrapper {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
}

.location-fields-wrapper > .form-group:not(:last-child) {
    margin-bottom: 1.5rem;
}

.coordinates-section {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
}

.btn-override {
    background: #e67e22;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Manrope', sans-serif;
    white-space: nowrap;
}

.btn-override:hover {
    background: #d35400;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.3);
}

.btn-override:active {
    transform: translateY(0);
}

.btn-override.active {
    background: #27ae60;
}

.btn-override.active:hover {
    background: #229954;
}

.conditional-field {
    margin-top: 0.5rem;
}

.revenue-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.revenue-row select {
    padding: 0.75rem 1rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Manrope', sans-serif;
    width: 100%;
    max-width: 600px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

.action-buttons {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn-success {
    background: linear-gradient(135deg, #31ebb5 0%, #298e8e 100%);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(49, 235, 181, 0.3);
}

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

/* Upload Trigger Buttons */
.upload-trigger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1rem;
    background: linear-gradient(135deg, #298e8e 0%, #1f7070 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Manrope', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(41, 142, 142, 0.2);
    box-sizing: border-box;
}

.upload-trigger-btn:hover {
    background: linear-gradient(135deg, #31ebb5 0%, #298e8e 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(49, 235, 181, 0.3);
}

.upload-trigger-btn:active {
    transform: translateY(0);
}

.upload-trigger-btn .btn-icon {
    flex-shrink: 0;
}

.upload-trigger-btn.has-file {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.upload-trigger-btn.has-file:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #233d3d;
}

.modal-close {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.btn-primary {
    background: linear-gradient(135deg, #31ebb5 0%, #298e8e 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Manrope', sans-serif;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(49, 235, 181, 0.3);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Manrope', sans-serif;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

/* File Upload Drag & Drop Styles */
.file-upload-wrapper {
    width: 100%;
}

.file-drop-zone {
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-drop-zone:hover {
    border-color: #298e8e;
    background: #f5f9ff;
}

.file-drop-zone.drag-over {
    border-color: #31ebb5;
    background: #e8f9f5;
    border-style: solid;
}

.file-drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.upload-icon {
    color: #298e8e;
    opacity: 0.6;
}

.file-drop-text {
    font-size: 1rem;
    color: #333;
    margin: 0;
}

.file-browse-link {
    color: #298e8e;
    font-weight: 600;
    text-decoration: underline;
}

.file-drop-hint {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}

.file-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.file-preview img {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-icon-large {
    color: #298e8e;
    opacity: 0.8;
}

.file-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.file-name {
    font-weight: 600;
    color: #233d3d;
    margin: 0;
    word-break: break-word;
    max-width: 100%;
    text-align: center;
}

.file-remove-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 600;
}

.file-remove-btn:hover {
    background: #c0392b;
}

/* Form Section Grouping */
.form-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid #e0e0e0;
}


.section-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #233d3d;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #298e8e;
}

.form-subsection {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    border: 1px solid #d0d0d0;
}

.subsection-title {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #298e8e;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

/* Key People Dynamic Fields */
#keyPeopleContainer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* Products Dynamic Fields */
#productsContainer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* Funding Dynamic Fields */
#fundingContainer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* News Dynamic Fields */
#newsContainer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.key-person-row {
    width: 100%;
}

.key-person-fields {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.product-fields {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.funding-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.funding-amount-wrapper {
    display: flex;
    gap: 0;
    align-items: center;
}

.funding-currency {
    padding: 0.75rem;
    border: 1px solid #d0d0d0;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 1rem;
    font-family: 'Manrope', sans-serif;
    background: #f0f0f0;
    color: #666;
    width: 70px;
    text-align: center;
    font-weight: 600;
    cursor: not-allowed;
}

.funding-amount-input {
    padding: 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: 0 6px 6px 0;
    font-size: 1rem;
    font-family: 'Manrope', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    flex: 1;
}

.funding-amount-input:focus {
    outline: none;
    border-color: #298e8e;
    box-shadow: 0 0 0 3px rgba(41, 142, 142, 0.1);
}

.news-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.key-person-name,
.key-person-function,
.product-input,
.funding-input {
    padding: 0.75rem;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Manrope', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.key-person-name:focus,
.key-person-function:focus,
.product-input:focus,
.funding-input:focus {
    outline: none;
    border-color: #298e8e;
    box-shadow: 0 0 0 3px rgba(41, 142, 142, 0.1);
}

.btn-remove-person {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
}

.btn-remove-person:hover {
    background: #c0392b;
}

.btn-add-person {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #298e8e 0%, #1f7070 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Manrope', sans-serif;
}

.btn-add-person:hover {
    background: linear-gradient(135deg, #31ebb5 0%, #298e8e 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(49, 235, 181, 0.3);
}

.btn-add-person svg {
    flex-shrink: 0;
}

/* Tooltip Styles */
.label-with-help {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #298e8e;
    color: white;
    font-size: 12px;
    font-weight: 700;
    cursor: help;
    position: relative;
    flex-shrink: 0;
}

.help-icon:hover {
    background: #31ebb5;
}

.tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #233d3d;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.5;
    white-space: normal;
    width: 280px;
    max-width: 90vw;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #233d3d;
}

.help-icon:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Map Container - ensure it stays below header */
#map {
    position: relative;
    z-index: 1;
}

/* Ensure all leaflet elements stay below header (header is z-index: 100) */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-popup,
.leaflet-control {
    z-index: auto !important;
}

/* Leaflet controls specifically */
.leaflet-top,
.leaflet-bottom {
    z-index: 10 !important;
}

/* Responsive */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 1.5rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .file-drop-zone {
        padding: 1.5rem;
        min-height: 150px;
    }

    .upload-icon {
        width: 48px;
        height: 48px;
    }

    .file-preview img {
        max-width: 150px;
        max-height: 150px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 1rem 1.5rem;
    }

    .modal-header h3 {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column-reverse;
    }

    .modal-footer button {
        width: 100%;
    }

    .upload-trigger-btn {
        font-size: 0.95rem;
        padding: 0.875rem 1.25rem;
    }

    .key-person-fields {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .funding-fields {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .funding-amount-wrapper {
        width: 100%;
    }

    .news-fields {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .btn-remove-person {
        width: 100%;
    }

    .form-section {
        padding: 1.5rem;
    }

    .section-title {
        font-size: 1.15rem;
    }

    .form-subsection {
        padding: 1rem;
    }

    .subsection-title {
        font-size: 1rem;
    }

    .coordinates-section {
        grid-template-columns: 1fr;
    }

    .btn-override {
        width: 100%;
    }
}
