﻿/* Base Dashboard Styles */
.dashboard-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: white;
}

.dashboard-header h2 {
    margin: 0;
    color: #343a40;
    font-weight: 600;
}

.dashboard-actions {
    display: flex;
    gap: 0.5rem;
}

/* View Mode Grid */
.dashboard-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 1rem;
    padding: 2rem;
    overflow: auto;
}

.dashboard-widget {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Edit Mode Styles */
.edit-mode-header {
    background: #343a40;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .edit-mode-header h3 {
        margin: 0;
        color: white;
    }

.edit-controls {
    display: flex;
    gap: 0.5rem;
}

.grid-container {
    flex: 1;
    display: flex;
    padding: 1rem;
    gap: 1rem;
    overflow: hidden;
}

/* Enhanced Grid System */
.enhanced-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(6, 120px);
    gap: 8px;
    padding: 1rem;
    border: 2px solid #343a40;
    border-radius: 8px;
    background: #f8f9fa;
    position: relative;
    user-select: none;
    overflow: visible;
}

    .enhanced-grid.show-grid {
        background: repeating-linear-gradient( to right, transparent 0, transparent calc(8.333% - 1px), rgba(0,123,255,0.2) calc(8.333% - 1px), rgba(0,123,255,0.2) calc(8.333% + 1px) ), repeating-linear-gradient( to bottom, transparent 0, transparent calc(120px + 8px - 1px), rgba(0,123,255,0.2) calc(120px + 8px - 1px), rgba(0,123,255,0.2) calc(120px + 8px + 1px) ), #f8f9fa;
    }

/* Grid Items */
.grid-item {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    min-height: 100px;
}

    .grid-item:hover {
        border-color: #007bff;
        box-shadow: 0 4px 12px rgba(0,123,255,0.2);
        z-index: 100;
    }

    .grid-item.selected {
        border-color: #28a745;
        border-width: 3px;
        box-shadow: 0 4px 16px rgba(40,167,69,0.3);
        z-index: 200;
    }

    .grid-item.dragging {
        opacity: 0.7;
        transform: rotate(3deg);
        z-index: 1000;
        box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    }

    .grid-item.resizing {
        border-color: #ffc107;
        border-style: dashed;
    }

/* Widget Header */
.widget-header {
    background: rgba(248,249,250,0.95);
    padding: 0.5rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    min-height: 40px;
}

.drag-handle {
    color: #6c757d;
    cursor: grab;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

    .drag-handle:hover {
        background: #007bff;
        color: white;
    }

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

.widget-controls {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
}

.widget-content-preview {
    flex: 1;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    overflow: hidden;
}

/* Resize Handles */
.resize-handles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.grid-item.selected .resize-handles {
    opacity: 1;
    pointer-events: all;
}

.resize-handle {
    position: absolute;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    pointer-events: all;
    transition: all 0.2s ease;
}

    .resize-handle:hover {
        background: #0056b3;
        transform: scale(1.2);
    }

.resize-nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.resize-n {
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    cursor: n-resize;
}

.resize-ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.resize-e {
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    cursor: e-resize;
}

.resize-se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.resize-s {
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    cursor: s-resize;
}

.resize-sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.resize-w {
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    cursor: w-resize;
}

/* Drag Preview */
.drag-preview {
    position: absolute;
    border: 2px dashed #007bff;
    background: rgba(0,123,255,0.1);
    border-radius: 8px;
    pointer-events: none;
    z-index: 999;
    transition: all 0.1s ease;
}

/* Drop Zone Indicators */
.drop-zone-indicators {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 998;
}

.drop-zone {
    position: absolute;
    border: 2px solid #28a745;
    background: rgba(40,167,69,0.1);
    border-radius: 4px;
    transition: all 0.1s ease;
}

/* Widget Palette */
.widget-palette {
    width: 300px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    max-height: 100%;
    overflow-y: auto;
    margin-right: 1rem;
}

.palette-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .palette-header h5 {
        margin: 0;
    }

.widget-category {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.category-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget-type-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

    .widget-type-card:hover {
        border-color: #007bff;
        background: #f8f9ff;
        box-shadow: 0 2px 4px rgba(0,123,255,0.1);
    }

.widget-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #007bff;
    font-size: 1.2rem;
}

.widget-type-info {
    flex: 1;
}

.widget-type-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #343a40;
}

.widget-type-description {
    color: #6c757d;
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Widget Properties Panel */
.widget-properties-panel {
    width: 300px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

.properties-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .properties-header h5 {
        margin: 0;
        font-size: 1rem;
    }

.properties-content {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.form-group {
    margin-bottom: 1rem;
}

    .form-group label {
        display: block;
        margin-bottom: 0.25rem;
        font-weight: 600;
        font-size: 0.9rem;
        color: #495057;
    }

.form-control {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 0.9rem;
}

.position-info {
    margin: 1rem 0;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.properties-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.cluster-units-tooltip ul {
    margin: 4px 0 0;
    padding-left: 16px;
}

.cluster-units-tooltip {
    max-width: 260px;
}