// ========================================
// THEME CUSTOMIZATION COMPONENT STYLES
// ========================================
@import '../../../../styles/design-tokens';

// Main Container
// ========================================

.theme-customization-screen {
  min-height: 100vh;
  background: var(--theme-background, $gray-50);
  padding: $space-6;
}

// Header
// ========================================

.theme-header {
  background: var(--theme-surface, $white);
  border-radius: $radius-2xl;
  box-shadow: var(--theme-shadow, $shadow-lg);
  margin-bottom: $space-8;
  padding: $space-6;

  .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: $space-4;

    @media (max-width: $breakpoint-md) {
      flex-direction: column;
      align-items: flex-start;
    }
  }

  .header-left {
    .page-title {
      display: flex;
      align-items: center;
      gap: $space-3;
      font-size: $text-3xl;
      font-weight: $font-bold;
      color: var(--theme-text, $gray-900);
      margin-bottom: $space-2;

      clr-icon {
        color: var(--theme-primary, $primary-500);
      }
    }

    .page-subtitle {
      font-size: $text-lg;
      color: var(--theme-text-secondary, $gray-600);
      margin: 0;
    }
  }

  .header-actions {
    display: flex;
    gap: $space-3;
    flex-shrink: 0;

    @media (max-width: $breakpoint-md) {
      width: 100%;
      justify-content: stretch;
    }
  }
}

// Main Content
// ========================================

.theme-content {
  .theme-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: $space-8;
    min-height: 600px;

    @media (max-width: $breakpoint-lg) {
      grid-template-columns: 1fr;
      gap: $space-6;
    }
  }
}

// Sidebar
// ========================================

.theme-sidebar {
  background: var(--theme-surface, $white);
  border-radius: $radius-2xl;
  box-shadow: var(--theme-shadow, $shadow-lg);
  padding: $space-6;
  height: fit-content;

  .sidebar-section {
    margin-bottom: $space-6;

    &:last-child {
      margin-bottom: 0;
    }
  }

  .section-title {
    font-size: $text-lg;
    font-weight: $font-semibold;
    color: var(--theme-text, $gray-900);
    margin-bottom: $space-4;
  }

  .theme-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: $space-4;
  }

  .theme-card {
    border: 2px solid transparent;
    border-radius: $radius-xl;
    padding: $space-4;
    cursor: pointer;
    transition: all $duration-200 $ease-out;
    background: var(--theme-surface, $white);

    &:hover {
      border-color: var(--theme-primary, $primary-200);
      transform: translateY(-2px);
      box-shadow: var(--theme-shadow, $shadow-lg);
    }

    &.active {
      border-color: var(--theme-primary, $primary-500);
      box-shadow: 0 0 0 3px rgba(var(--theme-primary, $primary-500), 0.1);
    }

    .theme-preview {
      height: 80px;
      border-radius: $radius-lg;
      overflow: hidden;
      margin-bottom: $space-3;
      position: relative;

      .preview-header {
        height: 20px;
        width: 100%;
      }

      .preview-content {
        padding: $space-3;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;

        .preview-card {
          width: 100%;
          height: 30px;
          display: flex;
          align-items: center;
          justify-content: center;
          box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

          .preview-text {
            font-size: $text-xs;
            font-weight: $font-medium;
          }
        }
      }
    }

    .theme-info {
      .theme-name {
        font-size: $text-sm;
        font-weight: $font-semibold;
        color: var(--theme-text, $gray-900);
        margin-bottom: $space-2;
      }

      .theme-colors {
        display: flex;
        gap: $space-2;

        .color-dot {
          width: 16px;
          height: 16px;
          border-radius: 50%;
          border: 2px solid var(--theme-surface, $white);
          box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }
      }
    }
  }
}

// Main Panel
// ========================================

.theme-main {
  background: var(--theme-surface, $white);
  border-radius: $radius-2xl;
  box-shadow: var(--theme-shadow, $shadow-lg);
  padding: $space-6;
  min-height: 600px;
}

// Welcome State
// ========================================

.welcome-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;

  .welcome-content {
    text-align: center;
    max-width: 500px;

    .welcome-icon {
      margin-bottom: $space-6;

      clr-icon {
        color: var(--theme-primary, $primary-500);
      }
    }

    h2 {
      font-size: $text-2xl;
      font-weight: $font-bold;
      color: var(--theme-text, $gray-900);
      margin-bottom: $space-4;
    }

    p {
      font-size: $text-lg;
      color: var(--theme-text-secondary, $gray-600);
      margin-bottom: $space-8;
      line-height: 1.6;
    }

    .current-theme-info {
      h3 {
        font-size: $text-xl;
        font-weight: $font-semibold;
        color: var(--theme-text, $gray-900);
        margin-bottom: $space-4;
      }

      .theme-preview-large {
        height: 120px;
        border-radius: $radius-xl;
        overflow: hidden;
        position: relative;
        box-shadow: var(--theme-shadow, $shadow-lg);

        .preview-header {
          height: 30px;
          width: 100%;
        }

        .preview-content {
          padding: $space-4;
          height: 90px;
          display: flex;
          align-items: center;
          justify-content: center;

          .preview-card {
            width: 100%;
            height: 50px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

            .preview-text {
              font-size: $text-sm;
              font-weight: $font-semibold;
              margin-bottom: 2px;
            }

            .preview-text-secondary {
              font-size: $text-xs;
            }
          }
        }
      }
    }
  }
}

// Customization Panel
// ========================================

.customization-panel {
  .customization-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: $space-8;
    padding-bottom: $space-4;
    border-bottom: 1px solid var(--theme-text-secondary, $gray-200);

    h2 {
      font-size: $text-2xl;
      font-weight: $font-bold;
      color: var(--theme-text, $gray-900);
      margin: 0;
    }

    .header-actions {
      display: flex;
      gap: $space-3;
    }
  }

  .customization-section {
    margin-bottom: $space-8;

    &:last-child {
      margin-bottom: 0;
    }

    .section-title {
      display: flex;
      align-items: center;
      gap: $space-2;
      font-size: $text-lg;
      font-weight: $font-semibold;
      color: var(--theme-text, $gray-900);
      margin-bottom: $space-4;

      clr-icon {
        color: var(--theme-primary, $primary-500);
      }
    }
  }
}

// Color Customization
// ========================================

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: $space-6;

  @media (max-width: $breakpoint-md) {
    grid-template-columns: 1fr;
  }
}

.color-group {
  .color-label {
    display: block;
    font-size: $text-sm;
    font-weight: $font-medium;
    color: var(--theme-text, $gray-700);
    margin-bottom: $space-2;
  }

  .color-input-group {
    display: flex;
    gap: $space-2;
    margin-bottom: $space-3;

    .color-picker {
      width: 40px;
      height: 40px;
      border: none;
      border-radius: $radius-lg;
      cursor: pointer;
      overflow: hidden;

      &::-webkit-color-swatch-wrapper {
        padding: 0;
      }

      &::-webkit-color-swatch {
        border: none;
        border-radius: $radius-lg;
      }
    }

    .color-text {
      flex: 1;
      padding: $space-2 $space-3;
      border: 1px solid var(--theme-text-secondary, $gray-300);
      border-radius: $radius-lg;
      font-size: $text-sm;
      color: var(--theme-text, $gray-900);
      background: var(--theme-surface, $white);

      &:focus {
        outline: none;
        border-color: var(--theme-primary, $primary-500);
        box-shadow: 0 0 0 3px rgba(var(--theme-primary, $primary-500), 0.1);
      }
    }
  }

  .color-presets {
    display: flex;
    gap: $space-2;
    flex-wrap: wrap;

    .preset-color {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      cursor: pointer;
      border: 2px solid var(--theme-surface, $white);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      transition: transform $duration-200 $ease-out;

      &:hover {
        transform: scale(1.1);
      }
    }
  }
}

// Font Customization
// ========================================

.font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: $space-6;

  @media (max-width: $breakpoint-md) {
    grid-template-columns: 1fr;
  }
}

.font-group {
  .font-label {
    display: block;
    font-size: $text-sm;
    font-weight: $font-medium;
    color: var(--theme-text, $gray-700);
    margin-bottom: $space-2;
  }

  .font-select {
    width: 100%;
    padding: $space-2 $space-3;
    border: 1px solid var(--theme-text-secondary, $gray-300);
    border-radius: $radius-lg;
    font-size: $text-sm;
    color: var(--theme-text, $gray-900);
    background: var(--theme-surface, $white);
    margin-bottom: $space-3;

    &:focus {
      outline: none;
      border-color: var(--theme-primary, $primary-500);
      box-shadow: 0 0 0 3px rgba(var(--theme-primary, $primary-500), 0.1);
    }
  }

  .font-preview {
    padding: $space-3;
    background: var(--theme-background, $gray-50);
    border-radius: $radius-lg;
    font-size: $text-sm;
    color: var(--theme-text, $gray-700);
    border: 1px solid var(--theme-text-secondary, $gray-200);
  }
}

// Advanced Settings
// ========================================

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: $space-6;

  @media (max-width: $breakpoint-md) {
    grid-template-columns: 1fr;
  }
}

.advanced-group {
  .advanced-label {
    display: block;
    font-size: $text-sm;
    font-weight: $font-medium;
    color: var(--theme-text, $gray-700);
    margin-bottom: $space-2;
  }

  .range-input-group {
    display: flex;
    align-items: center;
    gap: $space-3;

    .range-slider {
      flex: 1;
      height: 6px;
      border-radius: 3px;
      background: var(--theme-text-secondary, $gray-300);
      outline: none;
      cursor: pointer;

      &::-webkit-slider-thumb {
        appearance: none;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: var(--theme-primary, $primary-500);
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      }

      &::-moz-range-thumb {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: var(--theme-primary, $primary-500);
        cursor: pointer;
        border: none;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      }
    }

    .range-value {
      font-size: $text-sm;
      font-weight: $font-medium;
      color: var(--theme-text, $gray-700);
      min-width: 60px;
      text-align: center;
    }
  }
}

// Import/Export
// ========================================

.import-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: $space-6;

  @media (max-width: $breakpoint-md) {
    grid-template-columns: 1fr;
  }
}

.import-group {
  .import-label {
    display: block;
    font-size: $text-sm;
    font-weight: $font-medium;
    color: var(--theme-text, $gray-700);
    margin-bottom: $space-2;
  }

  .file-input {
    display: none;
  }
}

// Responsive Design
// ========================================

@media (max-width: $breakpoint-lg) {
  .theme-customization-screen {
    padding: $space-4;
  }

  .theme-header {
    padding: $space-4;
  }

  .theme-sidebar,
  .theme-main {
    padding: $space-4;
  }
}

@media (max-width: $breakpoint-md) {
  .theme-customization-screen {
    padding: $space-3;
  }

  .theme-header {
    padding: $space-3;
  }

  .theme-sidebar,
  .theme-main {
    padding: $space-3;
  }

  .color-grid,
  .font-grid,
  .advanced-grid,
  .import-export-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: $breakpoint-sm) {
  .theme-customization-screen {
    padding: $space-2;
  }

  .theme-header {
    padding: $space-3;
  }

  .theme-sidebar,
  .theme-main {
    padding: $space-3;
  }
}
