/**
 * HURE Map Integration Styles
 *
 * Clean, modern design for the ESRI map, popups, and forms.
 */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    --hure-primary: #2563eb;
    --hure-primary-hover: #1d4ed8;
    --hure-secondary: #10b981;
    --hure-secondary-hover: #059669;
    --hure-error: #dc2626;
    --hure-warning: #f59e0b;
    --hure-success: #059669;
    --hure-gray-50: #f9fafb;
    --hure-gray-100: #f3f4f6;
    --hure-gray-200: #e5e7eb;
    --hure-gray-300: #d1d5db;
    --hure-gray-400: #9ca3af;
    --hure-gray-500: #6b7280;
    --hure-gray-600: #4b5563;
    --hure-gray-700: #374151;
    --hure-gray-800: #1f2937;
    --hure-gray-900: #111827;
    --hure-radius: 8px;
    --hure-radius-lg: 12px;
    --hure-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --hure-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --hure-transition: 150ms ease;
}

/* ============================================
   Map Container
   ============================================ */
#hure-map,
.hure-map {
    width: 100%;
    height: 600px;
    border-radius: var(--hure-radius);
    overflow: hidden;
    box-shadow: var(--hure-shadow-lg);
}

/* ============================================
   Popup Styles
   ============================================ */
.hure-popup {
    max-width: 320px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--hure-gray-700);
}

.hure-popup__empty {
    color: var(--hure-gray-500);
    text-align: center;
    padding: 20px;
}

.hure-popup__image {
    margin: -12px -12px 12px -12px;
}

.hure-popup__image img {
    width: calc(100% + 24px);
    height: 160px;
    object-fit: cover;
    display: block;
}

.hure-popup__blurb {
    color: var(--hure-gray-600);
    margin: 0 0 12px 0;
}

.hure-popup__highlights {
    background: var(--hure-gray-50);
    padding: 12px;
    border-radius: var(--hure-radius);
    margin-bottom: 16px;
    border: 1px solid var(--hure-gray-200);
}

.hure-popup__highlights h4 {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: var(--hure-gray-800);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.hure-popup__highlights p {
    margin: 0;
    color: var(--hure-gray-600);
    font-size: 13px;
}

.hure-popup__brokerage {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    padding: 16px;
    border-radius: var(--hure-radius);
    margin-bottom: 16px;
    border-left: 4px solid var(--hure-secondary);
}

.hure-popup__brokerage h4 {
    font-size: 12px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--hure-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hure-brokerage__name {
    font-weight: 600;
    font-size: 16px;
    margin: 0 0 4px 0;
    color: var(--hure-gray-900);
}

.hure-brokerage__phone {
    margin: 0 0 12px 0;
}

.hure-brokerage__phone a {
    color: var(--hure-secondary);
    text-decoration: none;
    font-weight: 500;
}

.hure-brokerage__phone a:hover {
    text-decoration: underline;
}

.hure-popup__cta {
    text-align: center;
    padding-top: 12px;
    border-top: 1px solid var(--hure-gray-200);
}

.hure-popup__cta p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: var(--hure-gray-500);
}

.hure-popup__cta--secondary {
    border-top: none;
    padding-top: 0;
}

/* ============================================
   Buttons
   ============================================ */
.hure-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    text-align: center;
    transition: all var(--hure-transition);
    font-family: inherit;
}

.hure-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.hure-btn--primary {
    background: var(--hure-primary);
    color: white;
}

.hure-btn--primary:hover:not(:disabled) {
    background: var(--hure-primary-hover);
}

.hure-btn--secondary {
    background: var(--hure-secondary);
    color: white;
}

.hure-btn--secondary:hover:not(:disabled) {
    background: var(--hure-secondary-hover);
}

.hure-btn--outline {
    background: transparent;
    border: 2px solid var(--hure-primary);
    color: var(--hure-primary);
}

.hure-btn--outline:hover:not(:disabled) {
    background: var(--hure-primary);
    color: white;
}

.hure-btn--full {
    width: 100%;
}

/* ============================================
   Modal
   ============================================ */
.hure-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
}

.hure-modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hure-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.hure-modal__content {
    position: relative;
    background: white;
    padding: 32px;
    border-radius: var(--hure-radius-lg);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--hure-shadow-lg);
    animation: hure-modal-in 200ms ease-out;
}

@keyframes hure-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.hure-modal__content h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--hure-gray-900);
}

.hure-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--hure-gray-100);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hure-gray-500);
    transition: all var(--hure-transition);
}

.hure-modal__close:hover {
    background: var(--hure-gray-200);
    color: var(--hure-gray-700);
}

.hure-modal__close svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   Forms
   ============================================ */
.hure-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hure-form__intro {
    margin: 0 0 8px 0;
    color: var(--hure-gray-600);
}

.hure-form__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hure-form__field label {
    font-weight: 500;
    font-size: 14px;
    color: var(--hure-gray-700);
}

.hure-form__field input,
.hure-form__field textarea,
.hure-form__field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--hure-gray-300);
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color var(--hure-transition), box-shadow var(--hure-transition);
}

.hure-form__field input:focus,
.hure-form__field textarea:focus,
.hure-form__field select:focus {
    outline: none;
    border-color: var(--hure-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.hure-form__field input::placeholder,
.hure-form__field textarea::placeholder {
    color: var(--hure-gray-400);
}

.hure-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .hure-form__row {
        grid-template-columns: 1fr;
    }
}

.hure-form__checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hure-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.hure-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--hure-primary);
}

.hure-checkbox span {
    color: var(--hure-gray-700);
    font-size: 14px;
}

/* ============================================
   Success & Error States
   ============================================ */
.hure-success {
    text-align: center;
    padding: 32px 16px;
}

.hure-success__icon {
    width: 64px;
    height: 64px;
    color: var(--hure-success);
    margin-bottom: 16px;
}

.hure-success h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--hure-success);
}

.hure-success p {
    margin: 0 0 24px 0;
    color: var(--hure-gray-600);
}

.hure-error {
    background: #fef2f2;
    color: var(--hure-error);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    border: 1px solid #fecaca;
    animation: hure-shake 300ms ease;
}

@keyframes hure-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ============================================
   Broker Signup Form
   ============================================ */
.hure-broker-signup {
    max-width: 600px;
    margin: 0 auto;
    padding: 32px;
    background: white;
    border-radius: var(--hure-radius-lg);
    box-shadow: var(--hure-shadow-lg);
}

.hure-broker-signup h2 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 600;
    color: var(--hure-gray-900);
}

/* ============================================
   Request Form Standalone
   ============================================ */
.hure-request-form-standalone {
    max-width: 500px;
    margin: 0 auto;
    padding: 24px;
    background: white;
    border-radius: var(--hure-radius-lg);
    box-shadow: var(--hure-shadow);
}

/* ============================================
   ESRI Popup Overrides
   ============================================ */
.esri-popup__main-container {
    max-width: 360px !important;
}

.esri-popup__content {
    margin: 0 !important;
    padding: 12px !important;
}

.esri-popup__header-title {
    font-size: 16px !important;
    font-weight: 600 !important;
}

.esri-popup__button {
    color: var(--hure-primary) !important;
}

/* ============================================
   Loading State
   ============================================ */
.hure-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--hure-gray-500);
}

.hure-loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--hure-gray-200);
    border-top-color: var(--hure-primary);
    border-radius: 50%;
    animation: hure-spin 800ms linear infinite;
}

@keyframes hure-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    #hure-map,
    .hure-map {
        height: 400px;
        border-radius: 0;
    }

    .hure-modal__content {
        padding: 24px;
        margin: 16px;
        max-height: calc(100vh - 32px);
    }

    .hure-broker-signup {
        padding: 24px;
        margin: 16px;
    }
}
