import { css, cssManager } from '@design.estate/dees-element';

export const dashboardGridStyles = [
  cssManager.defaultStyles,
  css`
      :host {
        display: block;
        width: 100%;
        height: 100%;
        position: relative;
      }

      .grid-container {
        position: relative;
        width: 100%;
        min-height: 400px;
        box-sizing: border-box;
      }

      .grid-widget {
        position: absolute;
        will-change: auto;
      }
      
      :host([enableanimation]) .grid-widget {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      }

      .grid-widget.dragging {
        z-index: 1000;
        transition: none !important;
        opacity: 0.8;
        cursor: grabbing;
        pointer-events: none;
        will-change: transform;
      }
      
      .grid-widget.placeholder {
        pointer-events: none;
        z-index: 1;
      }
      
      .grid-widget.placeholder .widget-content {
        background: ${cssManager.bdTheme('rgba(59, 130, 246, 0.1)', 'rgba(59, 130, 246, 0.1)')};
        border: 2px dashed ${cssManager.bdTheme('#3b82f6', '#3b82f6')};
        box-shadow: none;
      }

      .grid-widget.resizing {
        transition: none !important;
      }

      .widget-content {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        overflow: hidden;
        background: ${cssManager.bdTheme('#ffffff', '#09090b')};
        border: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')};
        border-radius: 8px;
        box-shadow: ${cssManager.bdTheme(
          '0 1px 3px rgba(0, 0, 0, 0.1)',
          '0 1px 3px rgba(0, 0, 0, 0.3)'
        )};
        transition: box-shadow 0.2s ease;
      }

      .grid-widget:hover .widget-content {
        box-shadow: ${cssManager.bdTheme(
          '0 4px 12px rgba(0, 0, 0, 0.15)',
          '0 4px 12px rgba(0, 0, 0, 0.4)'
        )};
      }

      .grid-widget.dragging .widget-content {
        box-shadow: ${cssManager.bdTheme(
          '0 16px 48px rgba(0, 0, 0, 0.25)',
          '0 16px 48px rgba(0, 0, 0, 0.6)'
        )};
        transform: scale(1.05);
      }

      .widget-header {
        padding: 12px 16px;
        border-bottom: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')};
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 14px;
        font-weight: 600;
        color: ${cssManager.bdTheme('#09090b', '#fafafa')};
        background: ${cssManager.bdTheme('#f9fafb', '#0a0a0a')};
        cursor: grab;
        user-select: none;
      }
      
      .widget-header:hover {
        background: ${cssManager.bdTheme('#f4f4f5', '#18181b')};
      }
      
      .widget-header:active {
        cursor: grabbing;
      }

      .widget-header.locked {
        cursor: default;
      }
      
      .widget-header.locked:hover {
        background: ${cssManager.bdTheme('#f9fafb', '#0a0a0a')};
      }

      .widget-header dees-icon {
        font-size: 16px;
        color: ${cssManager.bdTheme('#71717a', '#71717a')};
      }

      .widget-body {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: auto;
        color: ${cssManager.bdTheme('#09090b', '#fafafa')};
      }

      .widget-body.has-header {
        top: 45px;
      }

      .resize-handle {
        position: absolute;
        background: transparent;
        z-index: 10;
      }

      .resize-handle:hover {
        background: ${cssManager.bdTheme('#3b82f6', '#3b82f6')};
        opacity: 0.3;
      }

      .resize-handle-e {
        cursor: ew-resize;
        width: 12px;
        right: -6px;
        top: 10%;
        height: 80%;
      }

      .resize-handle-s {
        cursor: ns-resize;
        height: 12px;
        width: 80%;
        bottom: -6px;
        left: 10%;
      }

      .resize-handle-se {
        cursor: se-resize;
        width: 20px;
        height: 20px;
        right: -2px;
        bottom: -2px;
        opacity: 0;
        transition: opacity 0.2s ease;
      }
      
      .resize-handle-se::after {
        content: '';
        position: absolute;
        right: 4px;
        bottom: 4px;
        width: 6px;
        height: 6px;
        border-right: 2px solid ${cssManager.bdTheme('#71717a', '#71717a')};
        border-bottom: 2px solid ${cssManager.bdTheme('#71717a', '#71717a')};
      }

      .grid-widget:hover .resize-handle-se {
        opacity: 0.7;
      }

      .resize-handle-se:hover {
        opacity: 1 !important;
      }
      
      .resize-handle-se:hover::after {
        border-color: ${cssManager.bdTheme('#3b82f6', '#3b82f6')};
      }

      .grid-placeholder {
        position: absolute;
        background: ${cssManager.bdTheme('#3b82f6', '#3b82f6')};
        opacity: 0.1;
        border-radius: 8px;
        border: 2px dashed ${cssManager.bdTheme('#3b82f6', '#3b82f6')};
        transition: all 0.2s ease;
        pointer-events: none;
      }

      .empty-state {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 400px;
        color: ${cssManager.bdTheme('#71717a', '#71717a')};
        text-align: center;
        padding: 32px;
      }

      .empty-state dees-icon {
        font-size: 48px;
        margin-bottom: 16px;
        opacity: 0.5;
      }
      
      .grid-lines {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        pointer-events: none;
        z-index: -1;
      }
      
      .grid-line-vertical {
        position: absolute;
        top: 0;
        bottom: 0;
        width: 1px;
        background: ${cssManager.bdTheme('#e5e7eb', '#27272a')};
        opacity: 0.3;
      }
      
      .grid-line-horizontal {
        position: absolute;
        left: 0;
        right: 0;
        height: 1px;
        background: ${cssManager.bdTheme('#e5e7eb', '#27272a')};
        opacity: 0.3;
      }
  `,
];
