/**
 * Memorial Stones Frontend - Simple & Clean
 * Simplified controls and reliable overlay display
 */

/* Grid Controls - Simplified Layout */
.ms-grid-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: center;
}

.ms-control-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.ms-control-section label {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 4px;
}

.ms-control-section select,
.ms-control-section input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Overlay Section - Simplified */
.ms-overlay-section {
    border-left: 2px solid #2271b1;
    padding-left: 15px;
    margin-left: 10px;
}

.ms-overlay-toggle {
    padding: 8px 16px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.ms-overlay-toggle:hover {
    background: #135e96;
}

.ms-overlay-toggle[aria-pressed="true"] {
    background: #d63638;
}

.ms-overlay-toggle[aria-pressed="true"]:hover {
    background: #b32d2e;
}

.ms-overlay-opacity-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.ms-overlay-opacity-control label {
    margin: 0;
    white-space: nowrap;
}

.ms-overlay-opacity-range {
    flex: 1;
    max-width: 150px;
}

.ms-overlay-opacity-value {
    font-size: 13px;
    font-weight: 600;
    color: #2271b1;
    min-width: 40px;
    text-align: right;
}

/* Overlay Status Messages */
.ms-overlay-status {
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    background: #e0f3ff;
    border-left: 3px solid #2271b1;
}

.ms-overlay-status.is-error {
    background: #fee;
    border-left-color: #d63638;
    color: #b32d2e;
}

.ms-overlay-status.is-warning {
    background: #fff8e5;
    border-left-color: #dba617;
    color: #996800;
}

/* Grid Overlay Image - Ensure Visibility */
.ms-grid-overlay-stage {
    position: relative;
    width: 100%;
    height: auto;
}

.ms-grid-overlay-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ms-grid-overlay-stage.overlay-active .ms-grid-overlay-image {
    opacity: var(--ms-grid-overlay-opacity, 0.7);
    visibility: visible;
}

.ms-simple-grid {
    position: relative;
    z-index: 2;
}

/* Grid Cells - Ensure Clickability */
.ms-grid-cell {
    position: relative;
    cursor: default;
}

.ms-grid-cell.ms-trigger {
    cursor: pointer;
}

.ms-grid-cell.ms-trigger:hover {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
    z-index: 10;
}

.ms-grid-cell.taken {
    cursor: pointer;
}

/* Status Indicators */
.ms-status-indicator {
    display: flex;
    gap: 15px;
    margin-left: auto;
    padding: 5px 10px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.ms-status-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.ms-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.ms-status-dot.available {
    background: #00a32a;
}

.ms-status-dot.taken {
    background: #d63638;
}

.ms-status-dot.empty {
    background: #ddd;
}

/* Zoom Controls */
.ms-zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ms-zoom-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ms-zoom-btn:hover {
    background: #f0f0f0;
    border-color: #2271b1;
}

.ms-zoom-level {
    font-size: 13px;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
    cursor: pointer;
    color: #2271b1;
}

.ms-zoom-level:hover {
    text-decoration: underline;
}

/* Expand Button */
.ms-expand-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.ms-expand-btn:hover {
    background: #f0f0f0;
    border-color: #2271b1;
}

.ms-expand-btn.active {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

/* Grid Result Message */
#ms-grid-result {
    font-size: 14px;
    color: #666;
    min-height: 20px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .ms-grid-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ms-control-section {
        width: 100%;
    }
    
    .ms-overlay-section {
        border-left: none;
        border-top: 2px solid #2271b1;
        padding-left: 0;
        padding-top: 15px;
        margin-left: 0;
        margin-top: 10px;
    }
    
    .ms-status-indicator {
        width: 100%;
        justify-content: space-around;
    }
}
