/* ========================================
   GRILE NOTARIALE - Main Styles
   Brand Color: #ED6D62
   ======================================== */

   /* Force z-index override for WordPress themes */
.choices[data-type*="select-multiple"] .choices__list--dropdown,
.choices__list[aria-expanded] {
    position: absolute !important;
    z-index: 99999 !important;
    top: 100% !important;
}

/* Container */
.grile-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.grile-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    align-items: start;
}

/* Form Panel */
.grile-form-panel {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.grile-form-panel h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 25px 0;
    color: #333;
}

/* Steps */
.grile-step {
    display: none;
}

.grile-step.active {
    display: block;
}

/* Form Groups */
.grile-form-group {
    margin-bottom: 20px;
}

.grile-form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

.grile-form-group input[type="text"],
.grile-form-group input[type="number"],
.grile-form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.grile-form-group input:focus,
.grile-form-group select:focus {
    outline: none;
    border-color: #ED6D62;
    box-shadow: 0 0 0 3px rgba(237, 109, 98, 0.1);
}

.grile-form-group select {
    cursor: pointer;
    background: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.grile-form-group select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.grile-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grile-form-group-small {
    max-width: 150px;
}

/* Checkboxes */
.grile-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.grile-checkbox-group label,
.grile-dotari-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.grile-checkbox-group label:hover,
.grile-dotari-group > label:hover {
    background-color: #f9f9f9;
}

.grile-checkbox-group input[type="checkbox"],
.grile-dotari-group input[type="checkbox"],
.grile-distanta-group input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

/* Dotări edilitare */
.grile-dotari-group {
    margin-bottom: 15px;
}

.grile-distanta-group {
    margin-left: 28px;
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.grile-distanta-group label {
    font-size: 13px;
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0;
}

/* Info Text */
.grile-info-text {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin: 20px 0;
    padding: 12px;
    background: #f8f9fa;
    border-left: 3px solid #ED6D62;
    border-radius: 4px;
}

/* Buttons */
.grile-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
}

.grile-btn-primary {
    background: #ED6D62;
    color: #ffffff;
}

.grile-btn-primary:hover:not(:disabled) {
    background: #d85d53;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(237, 109, 98, 0.3);
}

.grile-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.grile-btn-secondary {
    background: #fff;
    color: #ED6D62;
    border: 2px solid #ED6D62;
}

.grile-btn-secondary:hover {
    background: #ED6D62;
    color: #fff;
}

.grile-btn-full {
    width: 100%;
    margin-top: 15px;
}

/* Tabs */
.grile-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
}

.grile-tab {
    padding: 12px 24px;
    background: #f5f5f5;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
}

.grile-tab:hover {
    background: #e8e8e8;
    color: #ED6D62;
}

.grile-tab.active {
    background: #ED6D62;
    color: #ffffff !important;
    font-weight: 800;
    border-bottom-color: #ED6D62;
    box-shadow: 0 -2px 8px rgba(237, 109, 98, 0.3);
}

.grile-tab-content {
    display: none;
}

.grile-tab-content.active {
    display: block;
}

/* Anexe */
.grile-anexa-item {
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 15px;
    position: relative;
}

.grile-anexa-item .grile-btn-remove-anexa {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #dc3545;
    color: #fff;
    padding: 6px 12px;
    font-size: 13px;
}

/* Form Actions */
.grile-form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* ========================================
   RESULTS PANEL
   ======================================== */

.grile-results-panel {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: sticky;
    top: 20px;
}

.grile-results-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.grile-results-header h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #333;
}

.grile-results-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.grile-results-section {
    margin-bottom: 25px;
}

.grile-results-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #333;
    text-decoration: underline;
}

.grile-results-list {
    min-height: 30px;
}

.grile-results-empty {
    color: #999;
    font-size: 14px;
    margin: 0;
}

.grile-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
    margin-bottom: 8px;
}

.grile-result-item-text {
    flex: 1;
}

.grile-result-item-value {
    font-weight: 600;
    color: #ED6D62;
    margin-right: 10px;
}

.grile-result-item-actions {
    display: flex;
    gap: 8px;
}

.grile-result-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 16px;
}

.grile-result-item-actions button:hover {
    background: #e0e0e0;
}

.grile-results-total {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    text-align: center;
}

.grile-results-total h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
}

.grile-total-value {
    font-size: 28px;
    font-weight: 700;
    color: #ED6D62;
    margin: 0 0 15px 0;
}

.grile-results-note {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .grile-container {
        grid-template-columns: 1fr;
    }
    
    .grile-results-panel {
        position: relative;
        top: 0;
    }
}

@media (max-width: 640px) {
    .grile-form-row {
        grid-template-columns: 1fr;
    }
    
    .grile-tabs {
        flex-direction: column;
        gap: 0;
    }
    
    .grile-tab {
        border-bottom: 1px solid #e0e0e0;
        border-left: 3px solid transparent;
        text-align: left;
    }
    
    .grile-tab.active {
        border-left-color: #ED6D62;
        border-bottom-color: #e0e0e0;
    }
    
    .grile-distanta-group {
        flex-direction: column;
        gap: 5px;
    }
}

/* Loading State */
.grile-loading {
    opacity: 0.6;
    pointer-events: none;
}

.grile-btn.grile-loading::after {
    content: "...";
    animation: grile-dots 1.5s infinite;
}

@keyframes grile-dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Multi-select styling */
select[multiple] {
    padding: 0 !important;
    min-height: 160px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

select[multiple] option {
    padding: 10px 15px;
    border: none;
    margin: 0;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

select[multiple] option:hover {
    background: #f5f5f5;
}

select[multiple] option:checked {
    background: #ED6D62 !important;
    color: white !important;
    font-weight: 600;
}

/* Placeholder când nu e nimic selectat */
select[multiple]:invalid {
    color: #999;
}

/* ========================================
   CHOICES.JS CUSTOM STYLING
   ======================================== */

.grile-form-group {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.grile-choices {
    position: relative;
    z-index: 10;
}

.grile-choices.is-open {
    z-index: 1000 !important;
}

.grile-choices .choices__inner {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-height: 48px;
    padding: 8px 12px;
    font-size: 15px;
    position: relative;
    z-index: 10;
}

.grile-choices.is-open .choices__inner {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-color: #ED6D62;
}

.grile-choices.is-focused .choices__inner {
    border-color: #ED6D62;
    box-shadow: 0 0 0 3px rgba(237, 109, 98, 0.1);
}

.grile-choices .choices__list--multiple .choices__item {
    background-color: #ED6D62;
    border: 1px solid #ED6D62;
    color: #fff;
    font-size: 13px;
    padding: 6px 10px;
    margin: 3px;
    border-radius: 4px;
}

.grile-choices .choices__list--multiple .choices__item.is-highlighted {
    background-color: #d85d53;
    border-color: #d85d53;
}

.grile-choices .choices__button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 4.6L9.3 1.3l1.4 1.4L7.4 6l3.3 3.3-1.4 1.4L6 7.4 2.7 10.7 1.3 9.3 4.6 6 1.3 2.7 2.7 1.3z'/%3E%3C/svg%3E");
    border-left: 1px solid rgba(255,255,255,0.3);
    opacity: 1;
    padding: 0 8px;
}

.grile-choices .choices__list--dropdown {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    background: #fff;
    border: 1px solid #ED6D62;
    border-top: none;
    border-radius: 0 0 6px 6px;
    margin-top: 0 !important;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2) !important;
    max-height: 300px;
    overflow-y: auto;
}

.grile-choices .choices__list--dropdown .choices__item {
    padding: 12px 15px;
    font-size: 14px;
    background: #fff;
}

.grile-choices .choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: #f5f5f5;
    color: #333;
}

.grile-choices .choices__placeholder {
    color: #999;
    opacity: 1;
}

/* Force z-index when dropdown is open */
.grile-tab-content {
    position: relative;
    z-index: 1;
}

.grile-form-group:has(.is-open) {
    z-index: 1001 !important;
    position: relative;
}

.grile-tip-proprietate-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.grile-tip-btn {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #ddd;
    background: white;
    color: #333;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.grile-tip-btn:hover {
    border-color: #e74c3c;
    background: #fef5f5;
}

.grile-tip-btn.active {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

/* Remove old multi-select styles */
select[multiple].grile-multi-select {
    display: none !important;
}