/* ===== GRUNDSTILE ===== */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f1f5f9;
    /* slate-100 */
}

.card {
    background-color: white;
    border-radius: 0.75rem;
    /* rounded-xl */
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: flex;
    align-items: center;
    color: #4b5563;
    /* gray-600 */
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.input-group label svg {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
    color: #6b7280;
    /* gray-500 */
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    /* gray-300 */
    border-radius: 0.5rem !important;
    /* rounded-lg - force on all corners */
    padding: 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Override Bootstrap input-group that makes left corners square */
.input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    margin-left: 0 !important;
    border-top-left-radius: 0.5rem !important;
    border-bottom-left-radius: 0.5rem !important;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    /* blue-500 */
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.2);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
    /* gray-200 */
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    color: #4b5563;
    /* gray-600 */
    display: flex;
    align-items: center;
}

.result-label svg {
    width: 1rem;
    height: 1rem;
    margin-right: 0.75rem;
    color: #3b82f6;
}

.result-value {
    color: #111827;
    /* gray-900 */
    font-weight: 600;
    font-size: 1.125rem;
    /* text-lg */
    text-align: right;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.result-value .unit,
.sub-text {
    font-size: 0.875rem;
    /* text-sm */
    font-weight: 400;
    color: #6b7280;
    /* gray-500 */
    margin-left: 0.25rem;
}

.sub-text {
    width: 100%;
    text-align: right;
    font-size: 0.75rem;
}

.edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 0.5rem;
    color: #9ca3af;
    transition: color 0.2s;
    line-height: 1;
}

.edit-btn:hover {
    color: #3b82f6;
}

.reset-btn {
    background-color: #ef4444;
    color: white;
    border-radius: 50%;
    width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s;
    margin-left: 0;
    margin-right: 0.5rem;
}

.reset-btn:hover {
    transform: rotate(360deg);
}

.edit-input {
    width: 80px;
    text-align: right;
    padding: 0.25rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
}

.hidden {
    display: none !important;
}

.sub-headline {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    margin-top: 1rem;
}

.delta-box {
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    margin-right: 0.5rem;
}

.delta-box .unit {
    color: white;
}

.delta-green {
    background-color: #22c55e;
}

.delta-red {
    background-color: #ef4444;
}


/* ===== EINHEITLICHE DETAILS/SUMMARY STILE ===== */

details.result-item {
    padding: 0;
    flex-wrap: wrap;
    border-bottom: 1px solid #e5e7eb;
    /* graue Linie */
}

details.result-item:last-child {
    border-bottom: none;
}

details.result-item>summary {
    list-style: none;
    /* entfernt den Standard-Pfeil */
    padding: 0.75rem 0;
    width: 100%;
    cursor: pointer;
}

details.result-item>summary::-webkit-details-marker {
    display: none;
}

details.result-item[open]>summary .arrow-icon {
    transform: rotate(90deg);
}

.arrow-icon {
    transition: transform 0.2s;
    color: #3b82f6;
    /* Blauer Pfeil */
}

.details-content {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 0;
    font-size: 0.875rem;
    color: #4b5563;
    background-color: #f9fafb;
    /* Leicht grauer Hintergrund */
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.details-content>div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.details-content>div:last-child {
    border-bottom: none;
}

.details-content>div>span:first-child {
    color: #6b7280;
    /* Label etwas heller */
}

.details-content>div>span:last-child {
    font-weight: 500;
    color: #374151;
}

.details-content hr {
    border: none;
    border-top: 1px solid #d1d5db;
    margin: 0.5rem 0;
}

/* Stile für den Jahres-/Monats-Umschalter */
.long-term-sim-btn {
    background-color: transparent;
    color: #4b5563;
    /* gray-600 */
    transition: all 0.2s;
}

.long-term-sim-btn.active {
    background-color: white;
    color: #111827;
    /* gray-900 */
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

/* ===== STILE FÜR DEN DACH-PLANER ===== */

#global-actions-container {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.edge-select-icon {
    background-color: rgba(0, 123, 255, 0.8);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    width: 12px !important;
    height: 12px !important;
    margin-left: -6px !important;
    margin-top: -6px !important;
}

.leaflet-div-icon.leaflet-editing-icon {
    background: #4f46e5 !important;
    border-radius: 50% !important;
    border: 2px solid white !important;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.7) !important;
    width: 12px !important;
    height: 12px !important;
    margin-left: -7px !important;
    margin-top: -7px !important;
}

.area-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    background-color: #f9fafb;
    transition: all 0.3s ease-in-out;
    overflow: hidden;
}

.area-card.active {
    border-color: #3b82f6;
    background-color: white;
}

.area-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    width: 100%;
}

.area-summary h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #374151;
}

.area-card.expanded .arrow-icon {
    transform: rotate(90deg);
}

.area-content-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

.area-content-wrapper .area-content {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid #e5e7eb;
}

/* ===== STILE FÜR DEN DRUCK ===== */
@media print {

    body>nav,
    .print-button,
    details summary .arrow-icon,
    .edit-btn,
    #foerderung-details>summary,
    .reset-btn {
        display: none !important;
    }

    body {
        background-color: white !important;
    }

    .card,
    .result-item {
        box-shadow: none !important;
        border: 1px solid #e5e7eb;
        page-break-inside: avoid !important;
    }

    .delta-box {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    details {
        page-break-inside: avoid !important;
    }

    details[open] {
        padding-bottom: 0.5rem;
    }

    details>summary {
        pointer-events: none;
    }

    details>summary .arrow-icon {
        display: none;
    }
}

.area-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* ===== LADE-OVERLAY ===== */
.loader-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

#loader-overlay {
    backdrop-filter: blur(4px);
}


.pv-module {
    fill-color: #28323c;
    fill-opacity: 0.8;
    color: #a5f3fc;
    weight: 1;
}

.settings-btn {
    color: #6b7280;
    transition: all 0.2s ease-in-out;
}

.settings-btn:hover {
    color: #1d4ed8;
    transform: rotate(45deg);
}

.module-settings {
    background-color: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.distortion-slider {
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    outline: none;
    opacity: 0.9;
    -webkit-transition: .2s;
    transition: opacity .2s;
}

.distortion-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #3b82f6;
    cursor: pointer;
    border-radius: 50%;
}

.distortion-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #3b82f6;
    cursor: pointer;
    border-radius: 50%;
}

/* ===== Stile für das Einstellungs-Modal ===== */

.settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    /* gray-100 */
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    font-size: 0.875rem;
    /* text-sm */
    color: #374151;
    /* gray-700 */
}

.settings-input-group {
    display: flex;
    align-items: center;
}

.settings-input {
    width: 100px;
    /* Einheitliche Breite für das Input-Feld */
    text-align: right;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
}

.settings-unit {
    margin-left: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    /* gray-500 */
    width: 80px;
    /* Gibt der Einheit Platz, ohne das Input zu verschieben */
    white-space: nowrap;
}

.settings-info {
    grid-column: 2 / -1;
    /* Erstreckt sich über die zweite Spalte */
    font-size: 0.75rem;
    /* text-xs */
    color: #6b7280;
    /* gray-500 */
    margin-top: -0.5rem;
}

/* Stile für das anpassbare 3D-Fenster */
.resizable {
    /* WICHTIG: Wir deaktivieren den Standard-Regler des Browsers */
    resize: none;
    /* overflow: auto; bleibt, falls benötigt, aber für das 3D-Canvas nicht zwingend */
    position: relative;
    /* Notwendig, damit wir den Griff positionieren können */
}

/* NEU: Stil für unseren benutzerdefinierten Griff oben links */
.resizer-handle {
    width: 12px;
    height: 12px;
    background: #e5e7eb;
    /* gray-200 */
    border-left: 2px solid #a1a1aa;
    /* gray-400 */
    border-top: 2px solid #a1a1aa;
    /* gray-400 */
    position: absolute;
    left: 0;
    top: 0;
    cursor: nwse-resize;
    /* Cursor, der die Größenänderung anzeigt */
    z-index: 10;
    /* Stellt sicher, dass der Griff über dem Inhalt liegt */
}

@tailwind base;
@tailwind components;
@tailwind utilities;

.tab-link {
    @apply py-4 px-1 border-b-2 font-medium text-sm text-gray-500 hover:text-gray-700 hover:border-gray-300;
}

.active-tab {
    @apply border-blue-500 text-blue-600;
}

.input-text {
    @apply block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6 p-2;
}


/* ===== TESLA-MODUL ===== */
#car-grid-layout {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
    width: 520px;
    /* Breite angepasst */
    height: 220px;
}

.car-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    color: white;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.car-panel:hover {
    border-color: #3b82f6;
}

/* --- NEU: Stile für Tab-Buttons --- */
.tab-button {
    @apply w-full text-center px-4 py-2 rounded-lg font-semibold text-gray-600 transition-colors duration-200;
}

.tab-button.active {
    @apply bg-gray-800 text-white shadow-md;
}

.tab-button:not(.active):hover {
    @apply bg-gray-300;
}

/* Grid-Positionierung */
#frunk-btn {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
}

#climate-btn {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

#door-lock-btn {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

#battery-btn {
    grid-column: 3 / 4;
    grid-row: 1 / 3;
}

#trunk-btn {
    grid-column: 4 / 5;
    grid-row: 1 / 3;
}

/* Zustands-Farben */
.state-off {
    background-color: #64748b;
}

.state-on {
    background-color: #3b82f6;
}

.state-charging {
    background-color: #22c55e !important;
}

.state-plugged-in {
    background-color: #0284c7 !important;
}

/* Batterie-Füll-Animation */
#battery-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #16a34a;
    height: var(--soc-percent, 0%);
    /* Höhe wird per JS gesetzt */
    transition: height 0.5s ease-in-out;
    z-index: 5;
}

#battery-icon,
#battery-soc {
    position: relative;
    z-index: 10;
}

/* Lade-Anzeige */
#charge-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1rem;
    /* Platziert es unter dem Grid */
}

#charge-cable {
    width: 5px;
    height: 30px;
    background-color: #1f2937;
    /* Standard: Schwarz */
    position: relative;
}

#charge-stats {
    @apply bg-gray-800 text-white p-2 rounded-md text-xs leading-tight shadow-lg;
    min-width: 80px;
    text-align: center;
}

#charge-flow-dot {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: white;
    opacity: 0;
}

/* Zustand: Angesteckt */
#charge-display.state-plugged-in #charge-cable {
    background-color: #1f2937;
}

/* Zustand: Lädt */
#charge-display.state-charging #charge-cable {
    background-color: #22c55e;
}

#charge-display.state-charging #charge-flow-dot {
    opacity: 1;
    animation: flow-up 1.5s linear infinite;
}

.cost-input {
    @apply p-1 w-24 border rounded-md;
}

/* --- NEU: Stile für Detail-Steuerung --- */
.control-group {
    @apply p-4 border border-gray-200 rounded-lg;
}

.control-group h4 {
    @apply text-lg font-bold mb-3;
}

.control-item {
    @apply flex justify-between items-center py-2;
}

.control-item button {
    @apply px-4 py-1.5 bg-sky-500 text-white rounded-md font-semibold hover:bg-sky-600;
}

@keyframes flow-up {
    from {
        bottom: -10%;
    }

    to {
        bottom: 100%;
    }
}

/* Toast-Nachrichten */
.toast {
    @apply fixed bottom-5 right-5 py-3 px-5 rounded-lg text-white font-semibold shadow-xl;
    z-index: 1000;
}

.toast.info {
    @apply bg-blue-500;
}

.toast.success {
    @apply bg-green-500;
}

.toast.error {
    @apply bg-red-500;
}


/* ===== GEBÄUDE-EDITOR ===== */
.tab-button.active {
    border-color: #4f46e5;
    background-color: #eef2ff;
    color: #4f46e5;
    font-weight: 600;
}

#grundriss-canvas {
    cursor: crosshair;
    background-color: #ffffff;
    touch-action: none;
}

#grundriss-canvas.panning {
    cursor: grabbing !important;
}

#grundriss-canvas.pan-tool {
    cursor: grab;
}

.tool-button.active {
    background-color: #4f46e5;
    color: white;
}

.snap-button.active {
    background-color: #dbeafe;
    color: #1e40af;
    font-weight: 500;
}

/* Ticket Modal Styles */
#ticket-form-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#screenshot-preview-container {
    max-height: 300px;
    overflow-y: auto;
}

/* ===== SELECT2 DROPDOWN STYLING ===== */
.select2-container--default .select2-results__option {
    font-size: 0.75rem !important;
    padding: 0.5rem 0.75rem !important;
    line-height: 1.5 !important;
}

.select2-container--default .select2-selection--single {
    font-size: 0.75rem !important;
    height: auto !important;
    padding: 0.5rem 0.75rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    font-size: 0.75rem !important;
    line-height: 1.5 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    right: 0.75rem !important;
}

/* Make sure the select2 dropdown appears correctly */
.select2-container {
    z-index: 1 !important;
}

/* Ensure the select2 selection doesn't cover the floating label */
.select2-container--default .select2-selection--single {
    margin-top: 0 !important;
}

/* Style the select2 container to work with floating label */
#project-select+.select2-container {
    position: relative !important;
}

/* ===== GEOSEARCH STYLING ===== */
.leaflet-control-geosearch {
    border: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.leaflet-control-geosearch .leaflet-geosearch-bar {
    background-color: white !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem !important;
    padding: 0.5rem 0.75rem !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s !important;
}

.leaflet-control-geosearch .leaflet-geosearch-bar:focus-within {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

.leaflet-control-geosearch .leaflet-geosearch-bar form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.leaflet-control-geosearch .leaflet-geosearch-bar input {
    border: none !important;
    padding: 0 !important;
    font-size: 0.875rem !important;
    color: #111827 !important;
    background-color: transparent !important;
    outline: none !important;
    width: 220px;
    font-family: inherit !important;
    font-weight: 400 !important;
}

.leaflet-control-geosearch .leaflet-geosearch-bar input::placeholder {
    color: #9ca3af !important;
    font-weight: 400 !important;
}

.leaflet-control-geosearch .leaflet-geosearch-bar button {
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    color: #6b7280 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.leaflet-control-geosearch .leaflet-geosearch-bar button:hover {
    color: #4f46e5 !important;
}

.leaflet-control-geosearch .results {
    background-color: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    max-height: 400px !important;
    overflow-y: auto !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    margin-top: 0.5rem !important;
}

.leaflet-control-geosearch .results>* {
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid #f3f4f6 !important;
    cursor: pointer !important;
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
    color: #374151 !important;
    transition: all 0.15s ease !important;
    font-family: inherit !important;
    font-weight: 400 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.leaflet-control-geosearch .results>*:last-child {
    border-bottom: none !important;
}

.leaflet-control-geosearch .results>*:hover {
    background-color: #f9fafb !important;
    color: #111827 !important;
}

.leaflet-control-geosearch .results .active,
.leaflet-control-geosearch .results>*.active {
    background-color: #eef2ff !important;
    color: #4f46e5 !important;
    font-weight: 500 !important;
}

/* Scrollbar styling for results */
.leaflet-control-geosearch .results::-webkit-scrollbar {
    width: 6px;
}

.leaflet-control-geosearch .results::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 0 0.5rem 0.5rem 0;
}

.leaflet-control-geosearch .results::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.leaflet-control-geosearch .results::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ===== SIMPLE TAB NAVIGATION SYSTEM ===== */

/* Tab Navigation Buttons - Clean, professional style matching module buttons */
.tab-nav-button {
    border: none;
    background-color: #f3f4f6;
    color: #4b5563;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tab-nav-button.active {
    color: #ffffff;
    background-color: #2563eb;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.tab-nav-button:not(.active):hover:not(.disabled) {
    color: #1f2937;
    background-color: #e5e7eb;
}

.tab-nav-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #9ca3af;
}

/* Simple container - no fixed height */
#photovoltaik-container {
    min-height: 100vh;
    background-color: #f1f5f9;
}

/* Tab Panes - Simple show/hide */
.tab-pane {
    display: none;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.tab-pane.active {
    display: block;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */

@media (max-width: 768px) {
    .tab-nav-container {
        padding: 0.5rem;
        gap: 0.25rem;
        overflow-x: auto;
    }

    .tab-nav-button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .tab-pane {
        padding: 1rem;
    }
}

/* ===== MODAL SYSTEM ===== */
/* Global modal positioning - OVER module header and tabs, but UNDER nav (sticky z-50) */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 49 !important; /* Above everything except nav (z-50) */
    background-color: rgba(31, 41, 55, 0.75) !important; /* bg-gray-800 with 75% opacity */
    padding-top: 4rem !important; /* 64px - Platz für Nav-Header (h-16) */
}

/* Full-screen modal variant (covers everything including nav) */
.modal-overlay-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

/* ===== DACHFLÄCHE MODULE - AREA CARDS ===== */

/* Eave Arrow Indicator Styles */
.eave-arrow-indicator {
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.3s ease;
}

.eave-arrow-indicator:hover {
    transform: scale(1.2);
}

.eave-arrow-indicator .arrow-container {
    animation: pulseArrow 2s ease-in-out infinite;
}

@keyframes pulseArrow {
    0%, 100% {
        opacity: 1;
        transform: rotate(var(--arrow-rotation, 0deg)) translateX(0);
    }
    50% {
        opacity: 0.6;
        transform: rotate(var(--arrow-rotation, 0deg)) translateX(-5px);
    }
}

.area-card.collapsed .arrow-icon {
    transform: rotate(0deg);
}

.area-summary:hover {
    background: #f3f4f6;
}

.area-card.active .area-summary {
    background: #eff6ff;
}

.area-name-input {
    font-size: 1rem;
    font-weight: 600;
    border: none;
    outline: none;
    padding: 0.25rem;
    border-radius: 0.25rem;
    flex-grow: 1;
}

.area-name-input:focus {
    background: white;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.area-card.collapsed .arrow-icon {
    transform: rotate(0deg);
}

.area-content {
    padding: 1rem;
}

.area-mode-indicator {
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

/* Button styles */
.delete-area-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background 0.2s;
}

.delete-area-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Result text styles */
.ground-area-result,
.roof-area-result,
.azimuth-result,
.length-result {
    color: #059669;
}

.module-count-result,
.total-power-result {
    color: #2563eb;
}

/* Input styles */
.pitch-input,
.calculate-btn {
    transition: all 0.2s;
}

.pitch-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.calculate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== GERÄTEKATALOG MODULE ===== */

/* Device Cards */
.device-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.device-card:hover {
    transform: translateY(-2px);
}

/* AI Suggested Fields */
.ai-suggested {
    border-color: #9333ea !important;
    background-color: #faf5ff !important;
}

.ai-loading {
    border-color: #a855f7 !important;
    background: linear-gradient(90deg, #faf5ff 0%, #f3e8ff 50%, #faf5ff 100%) !important;
    background-size: 200% 100% !important;
    animation: ai-shimmer 1.5s ease-in-out infinite;
}

@keyframes ai-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.ai-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

/* PDF Viewer */
#pdf-viewer-container {
    background: #374151; /* gray-700 */
}

/* PDF Drag & Drop Zone */
.pdf-drop-zone {
    transition: all 0.3s ease;
    border: 2px dashed transparent;
    position: relative;
}

.pdf-drop-zone.drag-over {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.pdf-drop-zone.drag-over .drag-overlay {
    display: flex !important;
}

.pdf-drop-zone .drag-overlay {
    display: none;
}

#pdf-pages-container {
    padding-bottom: 20px;
}

.pdf-page-wrapper {
    background: white;
    margin-bottom: 16px;
}

.pdf-page-canvas {
    display: block;
}

/* PDF Text Layer - enables text selection */
.pdf-text-layer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0.2;
    line-height: 1.0;
}

.pdf-text-layer > span {
    color: transparent;
    position: absolute;
    white-space: pre;
    pointer-events: all;
}

.pdf-text-layer > span::selection {
    background: rgba(0, 0, 255, 0.3);
}

.pdf-text-layer > span::-moz-selection {
    background: rgba(0, 0, 255, 0.3);
}

/* Loading Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Line Clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Modal Backdrop - REMOVED: backdrop-filter caused white overlay issue */
/* #create-device-modal,
#device-detail-modal,
#approval-modal {
    backdrop-filter: blur(4px);
} */

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Scrollbar Styling for Modal */
#create-device-modal .overflow-y-auto::-webkit-scrollbar {
    width: 8px;
}

#create-device-modal .overflow-y-auto::-webkit-scrollbar-track {
    background: #f1f5f9;
}

#create-device-modal .overflow-y-auto::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#create-device-modal .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Split View Resize Handle */
.split-handle {
    width: 4px;
    background: #e5e7eb;
    cursor: col-resize;
    transition: background 0.2s;
}

.split-handle:hover {
    background: #3b82f6;
}

/* Checkbox Grid Styling */
#inverter-fields label.flex.items-center,
#storage-fields label.flex.items-center {
    white-space: nowrap;
}

#inverter-fields .grid.grid-cols-2 label,
#storage-fields .grid.grid-cols-2 label {
    min-height: 24px;
    display: flex;
    align-items: center;
}

/* Akkordeon Summary Styling */
details summary {
    list-style: none;
    user-select: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 8px;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

details[open] summary::before {
    transform: rotate(90deg);
}

/* Print Styles */
@media print {
    #create-device-modal,
    #device-detail-modal,
    #approval-modal {
        display: none !important;
    }
}
