/* ==========================================================================
   Property Inspection Booking - Modern Form Styles
   ========================================================================== */

/* Variables matching the requested aesthetic */
:root {
    --pib-primary-dark: #0f172a;     /* Dark Blue Header */
    --pib-primary-light: #1e293b;
    --pib-accent: #f59e0b;           /* Yellow/Orange Confirm Button */
    --pib-accent-hover: #d97706;
    --pib-bg-gray: #f8fafc;          /* Light gray form background */
    --pib-input-bg: #ffffff;
    --pib-border: #e2e8f0;
    --pib-text: #334155;
    --pib-text-light: #64748b;
    --pib-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --pib-radius-large: 16px;
    --pib-radius-small: 8px;
    --pib-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* Base Wrapper */
.pib-form-wrapper {
    font-family: var(--pib-font);
    background: var(--pib-bg-gray);
    border-radius: var(--pib-radius-large);
    box-shadow: var(--pib-shadow);
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.pib-form-wrapper * {
    box-sizing: border-box;
}

/* Header */
.pib-form-header {
    background: var(--pib-primary-dark);
    color: #fff;
    padding: 30px;
    text-align: center;
}

.pib-form-header h3 {
    margin: 0 0 8px 0 !important;
    font-size: 24px;
    font-weight: 700;
    color: #fff !important;
}

.pib-form-header p {
    margin: 0;
    font-size: 14px;
    color: #cbd5e1;
}

/* Body */
.pib-form-body {
    padding: 30px;
}

/* Section Titles */
.pib-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--pib-primary-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 25px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--pib-border);
}
.pib-section-title:first-child {
    margin-top: 0;
}

/* Grid Rows */
.pib-form-row {
    margin-bottom: 15px;
}
.pib-col-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
@media(max-width: 480px) {
    .pib-col-2 {
        grid-template-columns: 1fr;
    }
}

/* Form Groups & Labels */
.pib-form-group {
    margin-bottom: 15px;
    text-align: left;
}
.pib-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--pib-text);
}

/* Inputs & Icons */
.pib-input-icon {
    position: relative;
}
.pib-input-icon i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pib-text-light);
    font-size: 16px;
    pointer-events: none;
}

/* Since actual font-icons require an external library, we'll use emojis or SVG data URIs via CSS background for icons, or just padding without icons if unavailable. 
For a robust standalone plugin without enqueueing FontAwesome, we will use basic SVGs as backgrounds. */
.pib-input-icon input,
.pib-input-icon select {
    padding-left: 38px !important;
}
.pib-input-icon::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.5;
    pointer-events: none;
    z-index: 2;
}

/* Icon Variants embedded as SVGs to avoid dependencies */
.pib-input-icon:has(select[name="estate_name"])::before { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 21h18M5 21V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16M9 21v-4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v4M9 7h6M9 11h6"/></svg>'); }
.pib-input-icon:has(select[name="tour_type"])::before { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10zM2 12h20"/></svg>'); }
.pib-input-icon:has(input[name="preferred_date"])::before { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>'); }
.pib-input-icon:has(select[name="preferred_time"])::before { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>'); }
.pib-input-icon:has(input[name="pickup_location"])::before { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>'); }
.pib-input-icon:has(select[name="agent_name"])::before, .pib-input-icon:has(input[name="client_name"])::before { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>'); }
.pib-input-icon:has(input[name="client_phone"])::before { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/></svg>'); }
.pib-input-icon:has(input[name="client_email"])::before { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/></svg>'); }


.pib-form-group input,
.pib-form-group select,
.pib-form-group textarea {
    width: 100%;
    padding: 14px 14px;
    border: 1px solid var(--pib-border);
    border-radius: var(--pib-radius-small);
    background: var(--pib-input-bg);
    font-size: 15px;
    font-family: inherit;
    color: var(--pib-text);
    transition: all 0.2s ease;
    box-shadow: none;
    outline: none;
    min-height: 50px;
    line-height: normal;
}

.pib-form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2364748b" stroke-width="2"><polyline points="6 9 12 15 18 9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    height: 50px !important;
    line-height: 48px !important;
}

.pib-form-group input:focus,
.pib-form-group select:focus,
.pib-form-group textarea:focus {
    border-color: var(--pib-accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

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

/* Submit Button */
.pib-submit-wrap {
    margin-top: 25px;
    text-align: center;
}
.pib-submit-btn {
    width: 100%;
    background: var(--pib-accent);
    color: #fff;
    border: none;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--pib-radius-small);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pib-submit-btn:hover {
    background: var(--pib-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.pib-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Spinner */
.pib-spinner {
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: pib-spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes pib-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Form Message */
.pib-form-message {
    padding: 12px 15px;
    border-radius: var(--pib-radius-small);
    margin-top: 15px;
    font-size: 14px;
    text-align: center;
}
.pib-form-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.pib-form-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Modal specific styles */
.pib-trigger-btn {
    background: var(--pib-primary-dark);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--pib-radius-small);
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}
.pib-trigger-btn:hover {
    background: var(--pib-primary-light);
}

.pib-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pib-modal-overlay.pib-active {
    opacity: 1;
    visibility: visible;
}

.pib-modal-content {
    background: transparent;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--pib-radius-large);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pib-modal-overlay.pib-active .pib-modal-content {
    transform: translateY(0);
}

.pib-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s ease;
    z-index: 10;
}

.pib-close-btn:hover {
    background: rgba(255,255,255,0.4);
}

/* Hide scrollbar for modal content */
.pib-modal-content::-webkit-scrollbar {
    width: 6px;
}
.pib-modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.pib-modal-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}
