/**
 * Bottom Sheet Component Styles
 * Phase 3: Task 3.1
 * 
 * Reusable bottom sheet for forms and selections
 */

/* Bottom Sheet Overlay */
.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Bottom Sheet Container */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    z-index: 61;
    max-height: 90vh;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.dark .bottom-sheet {
    background: #1f2937;
}

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

/* Drag Handle */
.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 12px auto 8px;
    cursor: grab;
}

.dark .bottom-sheet-handle {
    background: #4b5563;
}

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

/* Bottom Sheet Header */
.bottom-sheet-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.dark .bottom-sheet-header {
    border-bottom-color: #374151;
}

.bottom-sheet-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.dark .bottom-sheet-title {
    color: #f9fafb;
}

.bottom-sheet-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .bottom-sheet-close {
    background: #374151;
    color: #f9fafb;
}

.bottom-sheet-close:hover {
    background: #e5e7eb;
    transform: scale(1.1);
}

.dark .bottom-sheet-close:hover {
    background: #4b5563;
}

.bottom-sheet-close:active {
    transform: scale(0.95);
}

/* Bottom Sheet Content */
.bottom-sheet-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.bottom-sheet-content::-webkit-scrollbar {
    width: 4px;
}

.bottom-sheet-content::-webkit-scrollbar-track {
    background: transparent;
}

.bottom-sheet-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.dark .bottom-sheet-content::-webkit-scrollbar-thumb {
    background: #4b5563;
}

/* Bottom Sheet Footer */
.bottom-sheet-footer {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: white;
}

.dark .bottom-sheet-footer {
    border-top-color: #374151;
    background: #1f2937;
}

/* Size Variants */
.bottom-sheet.small {
    max-height: 40vh;
}

.bottom-sheet.medium {
    max-height: 60vh;
}

.bottom-sheet.large {
    max-height: 90vh;
}

.bottom-sheet.full {
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
}

/* Dragging State */
.bottom-sheet.dragging {
    transition: none;
}

/* Animation States */
@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.bottom-sheet.animating {
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Prevent body scroll when bottom sheet is open */
body.bottom-sheet-open {
    overflow: hidden;
}

/* Mobile-specific adjustments */
@media (max-width: 767px) {
    .bottom-sheet {
        max-height: 95vh;
    }
    
    .bottom-sheet-content {
        padding: 16px;
    }
}

/* Desktop - show as modal */
@media (min-width: 768px) {
    .bottom-sheet {
        left: 50%;
        right: auto;
        bottom: 50%;
        transform: translate(-50%, 50%) translateY(100%);
        max-width: 500px;
        max-height: 80vh;
        border-radius: 16px;
    }
    
    .bottom-sheet.active {
        transform: translate(-50%, 50%) translateY(0);
    }
}


/* Hide appliance selector bottom sheet on desktop */
@media (min-width: 768px) {
    #appliance-selector-overlay,
    #appliance-selector-sheet {
        display: none !important;
    }
}
