/**
 * EXULO Mobile - Bottom Sheet & Modal Styles
 * Swipe-Up Detail Panels
 * Version: 1.0.0
 */

/* ============================================
   BOTTOM SHEET (Swipe Up für Details)
   ============================================ */

.bottom-sheet {
    position: fixed;
    bottom: var(--bottom-nav-height, 60px);
    left: 0;
    right: 0;
    max-height: 85dvh;
    background: var(--bg-card, #2a2a2a);
    border-radius: var(--radius-xl, 16px) var(--radius-xl, 16px) 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(calc(100% - var(--sheet-peek, 60px)));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: var(--z-modal, 500);
    /* Safe Area */
    bottom: calc(var(--bottom-nav-height, 60px) + var(--safe-area-bottom, 0px));
    /* Touch */
    touch-action: none;
    will-change: transform;
}

/* Sheet ohne Bottom Nav */
.bottom-sheet.no-nav {
    bottom: var(--safe-area-bottom, 0px);
}

/* Sheet Zustände */
.bottom-sheet.collapsed {
    transform: translateY(100%);
}

.bottom-sheet.peek {
    transform: translateY(calc(100% - var(--sheet-peek, 60px)));
}

.bottom-sheet.half {
    transform: translateY(50%);
}

.bottom-sheet.expanded {
    transform: translateY(0);
}

/* Dragging-Zustand (kein Transition) */
.bottom-sheet.dragging {
    transition: none;
}

/* ============================================
   SHEET HANDLE (Zieh-Indikator)
   ============================================ */

.sheet-handle {
    display: flex;
    justify-content: center;
    padding: var(--spacing-sm, 8px) 0;
    cursor: grab;
}

.sheet-handle:active {
    cursor: grabbing;
}

.sheet-handle-bar {
    width: 40px;
    height: 4px;
    background: var(--border-color, #444);
    border-radius: var(--radius-full, 9999px);
    transition: background var(--transition-fast, 150ms) ease;
}

.bottom-sheet:hover .sheet-handle-bar,
.bottom-sheet.dragging .sheet-handle-bar {
    background: var(--color-primary, #00d4ff);
}

/* ============================================
   SHEET HEADER
   ============================================ */

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md, 16px) var(--spacing-md, 16px);
    border-bottom: 1px solid var(--border-color, #444);
}

.sheet-title {
    font-size: var(--font-size-lg, 1.125rem);
    font-weight: var(--font-weight-bold, 600);
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 8px);
}

.sheet-title-icon {
    font-size: 1.25em;
}

.sheet-close {
    width: var(--touch-comfortable, 48px);
    height: var(--touch-comfortable, 48px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted, #666);
    font-size: 24px;
    cursor: pointer;
    border-radius: var(--radius-full, 9999px);
    transition: all var(--transition-fast, 150ms) ease;
}

.sheet-close:active {
    background: var(--bg-card-elevated, #3a3a3a);
    color: var(--text-primary, #fff);
}

/* ============================================
   SHEET BODY (Scrollbarer Inhalt)
   ============================================ */

.sheet-body {
    padding: var(--spacing-md, 16px);
    overflow-y: auto;
    max-height: calc(85dvh - 120px);
    -webkit-overflow-scrolling: touch;
}

/* Sections im Sheet */
.sheet-section {
    margin-bottom: var(--spacing-lg, 24px);
}

.sheet-section:last-child {
    margin-bottom: 0;
}

.sheet-section-title {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-secondary, #ccc);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-sm, 8px);
}

/* ============================================
   SHEET FOOTER (Action Buttons)
   ============================================ */

.sheet-footer {
    display: flex;
    gap: var(--spacing-sm, 8px);
    padding: var(--spacing-md, 16px);
    border-top: 1px solid var(--border-color, #444);
    background: var(--bg-card, #2a2a2a);
}

.sheet-footer .btn {
    flex: 1;
}

/* Sticky Footer */
.sheet-footer.sticky {
    position: sticky;
    bottom: 0;
}

/* ============================================
   SHEET PEEK CONTENT (Sichtbar wenn minimiert)
   ============================================ */

.sheet-peek-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md, 16px);
    height: calc(var(--sheet-peek, 60px) - 20px);
}

.sheet-peek-title {
    font-size: var(--font-size-base, 1rem);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-primary, #fff);
}

.sheet-peek-subtitle {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-secondary, #ccc);
}

.sheet-peek-action {
    color: var(--color-primary, #00d4ff);
    font-size: var(--font-size-sm, 0.875rem);
}

/* ============================================
   DETAIL CARDS (im Sheet)
   ============================================ */

.detail-card {
    background: var(--bg-card-dark, #1a1a1a);
    border: 1px solid var(--border-color, #444);
    border-radius: var(--radius-md, 8px);
    padding: var(--spacing-md, 16px);
    margin-bottom: var(--spacing-md, 16px);
}

.detail-card:last-child {
    margin-bottom: 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs, 4px) 0;
}

.detail-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color, #444);
    padding-bottom: var(--spacing-sm, 8px);
    margin-bottom: var(--spacing-sm, 8px);
}

.detail-label {
    font-size: var(--font-size-sm, 0.875rem);
    color: var(--text-secondary, #ccc);
}

.detail-value {
    font-size: var(--font-size-base, 1rem);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-primary, #fff);
}

.detail-value.highlight {
    color: var(--color-primary, #00d4ff);
}

.detail-value.success {
    color: var(--color-success, #4CAF50);
}

.detail-value.warning {
    color: var(--color-warning, #FFA726);
}

.detail-value.danger {
    color: var(--color-danger, #f44336);
}

/* ============================================
   RESOURCE COSTS (im Sheet)
   ============================================ */

.resource-costs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm, 8px);
}

.resource-cost {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs, 4px);
    padding: var(--spacing-sm, 8px);
    background: var(--bg-card-dark, #1a1a1a);
    border-radius: var(--radius-sm, 4px);
}

.resource-cost-icon {
    width: 20px;
    height: 20px;
}

.resource-cost-value {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: var(--font-weight-medium, 500);
}

.resource-cost.insufficient {
    border: 1px solid var(--color-danger, #f44336);
}

.resource-cost.insufficient .resource-cost-value {
    color: var(--color-danger, #f44336);
}

/* ============================================
   BACKDROP (für Sheet)
   ============================================ */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base, 250ms) ease;
    z-index: calc(var(--z-modal, 500) - 1);
}

.sheet-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   COLLAPSIBLE SECTIONS
   ============================================ */

.collapsible {
    background: var(--bg-card, #2a2a2a);
    border: 1px solid var(--border-color, #444);
    border-radius: var(--radius-md, 8px);
    margin-bottom: var(--spacing-sm, 8px);
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md, 16px);
    min-height: var(--touch-comfortable, 48px);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast, 150ms) ease;
}

.collapsible-header:active {
    background: var(--bg-card-elevated, #3a3a3a);
}

.collapsible-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 8px);
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-primary, #fff);
}

.collapsible-icon {
    font-size: 1.25em;
}

.collapsible-chevron {
    color: var(--text-muted, #666);
    transition: transform var(--transition-fast, 150ms) ease;
}

.collapsible.expanded .collapsible-chevron {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base, 250ms) ease;
}

.collapsible.expanded .collapsible-content {
    max-height: 1000px; /* Groß genug für jeden Content */
}

.collapsible-body {
    padding: 0 var(--spacing-md, 16px) var(--spacing-md, 16px);
    border-top: 1px solid var(--border-color, #444);
}

/* ============================================
   NUMBER STEPPER (für Bauanzahl etc.)
   ============================================ */

.number-stepper {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs, 4px);
    background: var(--bg-card-dark, #1a1a1a);
    border: 1px solid var(--border-color, #444);
    border-radius: var(--radius-md, 8px);
    padding: var(--spacing-xs, 4px);
}

.stepper-btn {
    width: var(--touch-comfortable, 48px);
    height: var(--touch-comfortable, 48px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card, #2a2a2a);
    border: none;
    border-radius: var(--radius-sm, 4px);
    color: var(--text-primary, #fff);
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition-fast, 150ms) ease;
}

.stepper-btn:active {
    background: var(--color-primary, #00d4ff);
    color: #000;
}

.stepper-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.stepper-input {
    flex: 1;
    min-width: 60px;
    height: var(--touch-comfortable, 48px);
    background: transparent;
    border: none;
    color: var(--text-primary, #fff);
    font-family: var(--font-family);
    font-size: var(--font-size-lg, 1.125rem);
    font-weight: var(--font-weight-bold, 600);
    text-align: center;
}

.stepper-input:focus {
    outline: none;
}

/* Quick Amount Buttons */
.stepper-presets {
    display: flex;
    gap: var(--spacing-xs, 4px);
    margin-top: var(--spacing-sm, 8px);
}

.preset-btn {
    flex: 1;
    padding: var(--spacing-sm, 8px);
    background: var(--bg-card, #2a2a2a);
    border: 1px solid var(--border-color, #444);
    border-radius: var(--radius-sm, 4px);
    color: var(--text-secondary, #ccc);
    font-size: var(--font-size-sm, 0.875rem);
    cursor: pointer;
    transition: all var(--transition-fast, 150ms) ease;
}

.preset-btn:active {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--color-primary, #00d4ff);
    color: var(--color-primary, #00d4ff);
}

/* ============================================
   PROGRESS BAR (im Sheet)
   ============================================ */

.progress-container {
    margin: var(--spacing-md, 16px) 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs, 4px);
    font-size: var(--font-size-sm, 0.875rem);
}

.progress-bar {
    height: 8px;
    background: var(--bg-card-dark, #1a1a1a);
    border-radius: var(--radius-full, 9999px);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary, #00d4ff), var(--color-primary-light, #4de4ff));
    border-radius: var(--radius-full, 9999px);
    transition: width var(--transition-base, 250ms) ease;
}

.progress-fill.success {
    background: linear-gradient(90deg, var(--color-success, #4CAF50), #66BB6A);
}

.progress-fill.warning {
    background: linear-gradient(90deg, var(--color-warning, #FFA726), #FFB74D);
}

.progress-fill.danger {
    background: linear-gradient(90deg, var(--color-danger, #f44336), #ff6659);
}
