/**
 * Frontend-Styles für Immobilien-Bewertung
 */

/* === Variablen === */
:root {
    --tib-primary: #1A2A4D;
    --tib-primary-hover: #0f1a35;
    --tib-secondary: #1A2A4D;
    --tib-success: #10b981;
    --tib-error: #ef4444;
    --tib-border: #e5e7eb;
    --tib-bg: #f3f4f6;
    --tib-card-bg: #ffffff;
    --tib-text: #1f2937;
    --tib-text-muted: #6b7280;
    --tib-radius: 8px;
    --tib-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --tib-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* === Wrapper === */
.tib-bewertung-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* === Header === */
.tib-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.tib-header-icon {
    display: inline-block;
    color: var(--tib-primary);
    margin-bottom: 1rem;
}

.tib-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #e8eaf0;
    color: var(--tib-primary);
    padding: 0.5rem 1.25rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.tib-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--tib-text);
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
}

.tib-subtitle {
    font-size: 1rem;
    color: var(--tib-text-muted);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* === Card === */
.tib-card {
    background: var(--tib-card-bg);
    border-radius: var(--tib-radius);
    box-shadow: var(--tib-shadow-lg);
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
}

.tib-card-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--tib-border);
}

.tib-card-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--tib-text);
    margin: 0 0 0.5rem 0;
}

.tib-card-description {
    color: var(--tib-text-muted);
    margin: 0;
}

/* === Form Sections === */
.tib-form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--tib-border);
}

.tib-form-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.tib-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tib-section-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2c3e50;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
}

.tib-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--tib-text);
    margin: 0;
}

/* === Form === */
.tib-form {
    width: 100%;
}

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

.tib-form-row-2 {
    grid-template-columns: 1fr 1fr;
}

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

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

.tib-label {
    font-weight: 600;
    color: var(--tib-text);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.tib-label-icon {
    color: var(--tib-text-muted);
    flex-shrink: 0;
}

.tib-required {
    color: var(--tib-error);
}

.tib-input-wrapper {
    position: relative;
}

.tib-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.tib-input,
.tib-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--tib-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: white;
}

.tib-input-wrapper .tib-input {
    padding-left: 2.5rem;
}

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

.tib-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* === Buttons === */
.tib-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.tib-button-large {
    padding: 1.125rem 2rem;
    font-size: 1.0625rem;
    width: 100%;
}

.tib-button-primary {
    background: var(--tib-primary);
    color: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.tib-button-primary:hover {
    background: var(--tib-primary-hover);
    box-shadow: 0 4px 12px rgba(26, 42, 77, 0.3);
    transform: translateY(-1px);
}

.tib-button-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.tib-button-secondary {
    background: var(--tib-bg);
    color: var(--tib-text);
    border: 2px solid var(--tib-border);
}

.tib-button-secondary:hover {
    background: white;
    border-color: var(--tib-primary);
    color: var(--tib-primary);
}

.tib-form-actions {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--tib-border);
}

/* === Result === */
.tib-result {
    margin-top: 2rem;
}

.tib-result-box {
    background: linear-gradient(135deg, #e8eaf0 0%, #f5f6f8 100%);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #dde0e8;
}

.tib-result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tib-result-icon {
    color: var(--tib-text-muted);
}

.tib-result-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--tib-text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.tib-result-value {
    text-align: center;
    font-size: 3.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0.5rem 0;
    line-height: 1.1;
}

.tib-result-range {
    text-align: center;
    font-size: 0.95rem;
    color: var(--tib-text-muted);
    margin-bottom: 2rem;
    font-weight: 500;
}

.tib-result-info {
    background: white;
    padding: 1.75rem;
    border-radius: 10px;
    margin-top: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tib-result-hint {
    margin: 0 0 1.5rem 0;
    line-height: 1.6;
    color: var(--tib-text);
    font-size: 0.95rem;
}

.tib-result-hint strong {
    color: var(--tib-primary);
}

.tib-factors-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--tib-border);
}

.tib-factors-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--tib-text);
    margin: 0 0 1rem 0;
}

.tib-result-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dde0e8;
}

.tib-result-cta-text {
    margin: 0 0 1rem 0;
    color: var(--tib-text-muted);
    font-size: 0.95rem;
}

.tib-button-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    color: var(--tib-primary);
    border: 2px solid var(--tib-primary);
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.tib-button-outline:hover {
    background: var(--tib-primary);
    color: white;
    gap: 0.75rem;
}

.tib-button-outline svg {
    transition: transform 0.2s;
}

.tib-button-outline:hover svg {
    transform: translateX(3px);
}

.tib-button-appointment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--tib-primary);
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(26, 42, 77, 0.25);
}

.tib-button-appointment:hover {
    background: var(--tib-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 42, 77, 0.35);
}

.tib-button-appointment svg {
    flex-shrink: 0;
}

/* === Trust Elements === */
.tib-trust-elements {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2.5rem;
    padding: 1.5rem 0;
}

.tib-trust-elements-detail {
    grid-template-columns: repeat(4, 1fr);
}

.tib-trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 0;
    text-align: center;
}

.tib-trust-icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f5f6f8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tib-text-muted);
}

.tib-trust-text {
    font-size: 0.875rem;
    color: var(--tib-text-muted);
    font-weight: 500;
    line-height: 1.4;
}

/* === Modal === */
.tib-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 2147483647 !important;
    display: none;
}

.tib-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px);
    z-index: 2147483647 !important;
}

.tib-modal-content {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: white !important;
    border-radius: var(--tib-radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 2147483647 !important;
}

.tib-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    z-index: 2147483647 !important;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--tib-text-muted);
    transition: color 0.2s;
}

.tib-modal-close:hover {
    color: var(--tib-text);
}

.tib-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--tib-text);
    margin: 0 0 0.5rem 0;
}

.tib-modal-description {
    color: var(--tib-text-muted);
    margin: 0 0 1.5rem 0;
}

.tib-modal-success {
    text-align: center;
    padding: 3rem 2rem;
}

.tib-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--tib-success);
    color: white;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: tib-success-pop 0.5s ease-out;
}

.tib-success-icon svg {
    width: 48px;
    height: 48px;
}

@keyframes tib-success-pop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.tib-modal-success h4 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--tib-text);
    margin: 0 0 0.75rem 0;
}

.tib-modal-success p {
    font-size: 1rem;
    color: var(--tib-text-muted);
    margin: 0;
    line-height: 1.6;
}

.tib-checkbox-group {
    margin: 1.5rem 0;
}

.tib-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--tib-text);
    cursor: pointer;
    line-height: 1.5;
}

.tib-checkbox {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.tib-checkbox-text {
    flex: 1;
}

.tib-checkbox-label a {
    color: var(--tib-primary);
    text-decoration: underline;
    font-weight: 600;
}

.tib-checkbox-label a:hover {
    text-decoration: none;
}

/* === Icons === */
.tib-icon {
    display: inline-block;
}

/* Phone Icon (Lucide Style) */
.tib-icon-phone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.tib-icon-phone svg {
    width: 100%;
    height: 100%;
}

/* Button mit Phone Icon - Kompatibel mit Salient Theme button_solid_color */

/* Für WordPress-Menü-Items mit button_solid_color: Verwende Pseudo-Element für Icon */
#header-outer #top nav > ul > li.tib-button-phone[class*="button_solid_color"] > a,
#header-outer #top nav > ul > li.tib-button-phone[class*="button_bordered"] > a {
    padding-left: 48px !important; /* Platz für Icon links */
    position: relative;
}

/* Phone Icon als zusätzliches Pseudo-Element (nutzt ::after statt ::before, da Theme ::before nutzt) */
#header-outer #top nav > ul > li.tib-button-phone[class*="button_solid_color"] > a::after,
#header-outer #top nav > ul > li.tib-button-phone[class*="button_bordered"] > a::after {
    content: '' !important;
    position: absolute !important;
    left: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 18px !important;
    height: 18px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath 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'%3E%3C/path%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    z-index: 10 !important;
}

/* Für button_bordered: Icon in dunkler Farbe */
#header-outer #top nav > ul > li.tib-button-phone[class*="button_bordered"] > a::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(0,0,0,0.7)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath 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'%3E%3C/path%3E%3C/svg%3E") !important;
}

/* Für direkte Verwendung auf normalen Buttons/Links (ohne Theme-Klassen) */
a.tib-button-phone:not([class*="button_solid_color"]):not([class*="button_bordered"]),
button.tib-button-phone {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
}

a.tib-button-phone:not([class*="button_solid_color"]):not([class*="button_bordered"])::before,
button.tib-button-phone::before {
    content: '' !important;
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath 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'%3E%3C/path%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    flex-shrink: 0 !important;
}

/* === Spinner === */
.tib-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: tib-spin 0.6s linear infinite;
}

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

/* === Responsive === */
@media (max-width: 768px) {
    .tib-title {
        font-size: 2rem;
    }
    
    .tib-subtitle {
        font-size: 1rem;
    }
    
    .tib-card {
        padding: 1.5rem;
    }
    
    .tib-form-row,
    .tib-form-row-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tib-section-header {
        gap: 0.75rem;
    }
    
    .tib-section-number {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }
    
    .tib-section-title {
        font-size: 1rem;
    }
    
    .tib-result-value {
        font-size: 2.5rem;
    }
    
    .tib-result-box {
        padding: 2rem 1.5rem;
    }
    
    .tib-trust-elements,
    .tib-trust-elements-detail {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tib-trust-icon-circle {
        width: 48px;
        height: 48px;
    }
    
    .tib-button-appointment {
        font-size: 0.95rem;
        padding: 0.875rem 1.25rem;
    }
    
    .tib-modal-content {
        padding: 1.5rem;
    }
}

/* === Body-Klasse wenn Modal offen === */
body.tib-modal-open {
    overflow: hidden !important;
    position: relative;
}

/* Verhindert, dass andere Elemente über dem Modal liegen */
body.tib-modal-open > *:not(#tib-modal) {
    position: relative;
    z-index: auto !important;
}

body.tib-modal-open header,
body.tib-modal-open nav,
body.tib-modal-open .header,
body.tib-modal-open .navigation,
body.tib-modal-open [class*="sticky"],
body.tib-modal-open [class*="fixed"] {
    z-index: auto !important;
}

/* === Extras (Detailrechner) === */
.tib-extras-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.tib-extra-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px solid var(--tib-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.tib-extra-item:hover {
    border-color: var(--tib-primary);
}

.tib-extra-item.selected {
    border-color: var(--tib-primary);
    background: rgba(37, 99, 235, 0.05);
}

.tib-extra-item input[type="checkbox"] {
    margin: 0;
}

.tib-extra-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tib-text);
    cursor: pointer;
}

/* === Faktoren-Liste === */
.tib-factors-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 1rem 0;
}

.tib-factor-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--tib-text-muted);
}

.tib-factor-bullet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background: var(--tib-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .tib-extras-grid,
    .tib-factors-list {
        grid-template-columns: 1fr;
    }
}
