/*
 * OSUS.AI - Design Studio Styles
 * Version: 1.0.0
 * Component: 3D Design Tools & Room Planner
 * Dependencies: main.css, Bootstrap 5.3
 * Last Updated: June 2025
 */

/* ===================================
   DESIGN STUDIO LAYOUT
   =================================== */

   .design-studio-page {
    background: var(--osus-gray-50);
    min-height: 100vh;
    overflow-x: hidden;
  }
  
  .design-studio-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
  }
  
  /* Design Toolbar */
  .design-toolbar {
    background: white;
    border-bottom: 1px solid var(--osus-gray-200);
    box-shadow: var(--osus-shadow-sm);
    z-index: var(--osus-z-sticky);
    position: sticky;
    top: 0;
    padding: var(--osus-space-3) 0;
  }
  
  .design-toolbar .container-fluid {
    max-width: none;
  }
  
  .design-toolbar h1 {
    font-size: var(--osus-text-lg);
    margin: 0;
    color: var(--osus-gray-800);
  }
  
  /* Main Design Area */
  .design-main-area {
    flex: 1;
    overflow: hidden;
    background: var(--osus-gray-100);
  }
  
  .design-main-area .row {
    height: 100%;
    margin: 0;
  }
  
  /* ===================================
     DESIGN SIDEBAR
     =================================== */
  
  .design-sidebar {
    background: white;
    border-right: 1px solid var(--osus-gray-200);
    box-shadow: var(--osus-shadow-sm);
    overflow-y: auto;
    max-height: calc(100vh - 80px);
  }
  
  .sidebar-content {
    padding: var(--osus-space-4);
    height: 100%;
  }
  
  .sidebar-header {
    border-bottom: 1px solid var(--osus-gray-200);
    padding-bottom: var(--osus-space-4);
    margin-bottom: var(--osus-space-4);
  }
  
  .sidebar-header h6 {
    color: var(--osus-gray-800);
    font-weight: 600;
    margin-bottom: var(--osus-space-3);
    display: flex;
    align-items: center;
    gap: var(--osus-space-2);
  }
  
  /* Category Navigation */
  .nav-tabs {
    border-bottom: 1px solid var(--osus-gray-200);
    margin-bottom: var(--osus-space-4);
  }
  
  .nav-tabs .nav-link {
    background: none;
    border: 1px solid transparent;
    color: var(--osus-gray-600);
    padding: var(--osus-space-2) var(--osus-space-3);
    font-size: var(--osus-text-sm);
    font-weight: 500;
    border-radius: var(--osus-radius-md) var(--osus-radius-md) 0 0;
    transition: var(--osus-transition-fast);
    display: flex;
    align-items: center;
    gap: var(--osus-space-1);
  }
  
  .nav-tabs .nav-link:hover {
    border-color: var(--osus-gray-300);
    background: var(--osus-sand-light);
    color: var(--osus-primary);
  }
  
  .nav-tabs .nav-link.active {
    background: var(--osus-primary);
    color: white;
    border-color: var(--osus-primary);
  }
  
  /* Product Categories */
  .product-categories {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: var(--osus-space-4);
  }
  
  .category-group {
    border: 1px solid var(--osus-gray-200);
    border-radius: var(--osus-radius-md);
    overflow: hidden;
    transition: var(--osus-transition-fast);
  }
  
  .category-group:hover {
    border-color: var(--osus-primary);
    box-shadow: var(--osus-shadow-sm);
  }
  
  .category-header {
    background: var(--osus-sand-light);
    color: var(--osus-gray-700);
    font-size: var(--osus-text-sm);
    font-weight: 500;
    transition: var(--osus-transition-fast);
    user-select: none;
  }
  
  .category-header:hover {
    background: var(--osus-primary);
    color: white;
  }
  
  .category-header i {
    width: 16px;
    text-align: center;
  }
  
  /* Product Grid */
  .product-grid {
    max-height: calc(100vh - 500px);
    overflow-y: auto;
    padding: var(--osus-space-2);
    background: var(--osus-gray-50);
    border-radius: var(--osus-radius-md);
  }
  
  .product-item {
    background: white;
    border: 1px solid var(--osus-gray-200);
    border-radius: var(--osus-radius-md);
    padding: var(--osus-space-3);
    margin-bottom: var(--osus-space-2);
    cursor: grab;
    transition: var(--osus-transition-fast);
    position: relative;
  }
  
  .product-item:hover {
    border-color: var(--osus-primary);
    box-shadow: var(--osus-shadow-md);
    transform: translateY(-1px);
  }
  
  .product-item:active {
    cursor: grabbing;
  }
  
  .product-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    z-index: var(--osus-z-50);
  }
  
  .product-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: var(--osus-radius-base);
    margin-bottom: var(--osus-space-2);
  }
  
  .product-item h6 {
    font-size: var(--osus-text-sm);
    font-weight: 500;
    color: var(--osus-gray-800);
    margin-bottom: var(--osus-space-1);
    line-height: 1.3;
  }
  
  .product-item .price {
    font-size: var(--osus-text-sm);
    font-weight: 600;
    color: var(--osus-primary);
  }
  
  /* ===================================
     DESIGN CANVAS
     =================================== */
  
  .design-canvas-container {
    background: var(--osus-gray-100);
    position: relative;
    overflow: hidden;
  }
  
  .design-canvas {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(45deg, 
      var(--osus-gray-100) 25%, 
      transparent 25%), 
      linear-gradient(-45deg, 
      var(--osus-gray-100) 25%, 
      transparent 25%), 
      linear-gradient(45deg, 
      transparent 75%, 
      var(--osus-gray-100) 75%), 
      linear-gradient(-45deg, 
      transparent 75%, 
      var(--osus-gray-100) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    overflow: hidden;
    user-select: none;
  }
  
  /* Room Templates */
  .room-template {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .room-boundaries {
    position: relative;
    width: 600px;
    height: 450px;
    max-width: 90%;
    max-height: 80%;
  }
  
  .room-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
  }
  
  /* Room-specific styling */
  .living-room-template .room-svg rect {
    fill: rgba(135, 206, 235, 0.1);
    stroke: var(--osus-primary);
  }
  
  .bedroom-template .room-svg rect {
    fill: rgba(233, 30, 140, 0.1);
    stroke: #e91e8c;
  }
  
  .kitchen-template .room-svg path {
    fill: rgba(253, 126, 20, 0.1);
    stroke: #fd7e14;
  }
  
  .bathroom-template .room-svg rect {
    fill: rgba(32, 201, 151, 0.1);
    stroke: #20c997;
  }
  
  /* Furniture Items Container */
  .furniture-items {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
  }
  
  .furniture-item {
    position: absolute;
    cursor: move;
    pointer-events: all;
    transition: var(--osus-transition-fast);
    z-index: 3;
  }
  
  .furniture-item:hover {
    z-index: 4;
  }
  
  .furniture-item.selected {
    outline: 2px solid var(--osus-primary);
    outline-offset: 2px;
    z-index: 5;
  }
  
  .furniture-item.dragging {
    z-index: 50;
    opacity: 0.8;
    transform: scale(1.05);
  }
  
  /* Canvas Controls */
  .canvas-controls {
    position: absolute;
    bottom: var(--osus-space-4);
    right: var(--osus-space-4);
    background: white;
    border-radius: var(--osus-radius-lg);
    box-shadow: var(--osus-shadow-lg);
    padding: var(--osus-space-3);
    z-index: var(--osus-z-40);
  }
  
  .zoom-controls {
    display: flex;
    align-items: center;
    gap: var(--osus-space-2);
  }
  
  .zoom-level {
    font-size: var(--osus-text-sm);
    font-weight: 500;
    color: var(--osus-gray-700);
    min-width: 40px;
    text-align: center;
  }
  
  .view-controls {
    text-align: center;
  }
  
  /* Drop Zones */
  .drop-zone {
    position: absolute;
    border: 2px dashed var(--osus-primary);
    background: rgba(44, 90, 160, 0.1);
    border-radius: var(--osus-radius-md);
    display: none;
    z-index: 1;
  }
  
  .drop-zone.active {
    display: block;
    animation: pulse 1s infinite;
  }
  
  @keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
  }
  
  /* Canvas View Modes */
  .canvas-2d .room-svg {
    display: block;
  }
  
  .canvas-3d .room-svg {
    display: none;
  }
  
  .canvas-ar .room-svg {
    display: none;
  }
  
  /* ===================================
     PROPERTIES PANEL
     =================================== */
  
  .properties-panel {
    background: white;
    border-left: 1px solid var(--osus-gray-200);
    box-shadow: var(--osus-shadow-sm);
    overflow-y: auto;
    max-height: calc(100vh - 80px);
  }
  
  .panel-content {
    padding: var(--osus-space-4);
    height: 100%;
  }
  
  .panel-header {
    border-bottom: 1px solid var(--osus-gray-200);
    padding-bottom: var(--osus-space-4);
    margin-bottom: var(--osus-space-4);
  }
  
  .panel-header h6 {
    color: var(--osus-gray-800);
    font-weight: 600;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: var(--osus-space-2);
  }
  
  /* Property Groups */
  .property-group {
    margin-bottom: var(--osus-space-6);
    padding-bottom: var(--osus-space-4);
    border-bottom: 1px solid var(--osus-gray-100);
  }
  
  .property-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
  }
  
  .property-group .form-label {
    font-weight: 600;
    color: var(--osus-gray-700);
    margin-bottom: var(--osus-space-3);
  }
  
  /* Color Palette */
  .color-palette {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--osus-space-2);
  }
  
  .color-option {
    cursor: pointer;
    padding: var(--osus-space-2);
    border: 2px solid transparent;
    border-radius: var(--osus-radius-md);
    transition: var(--osus-transition-fast);
    text-align: center;
  }
  
  .color-option:hover {
    border-color: var(--osus-gray-300);
  }
  
  .color-option.active {
    border-color: var(--osus-primary);
    background: rgba(44, 90, 160, 0.05);
  }
  
  .color-swatch {
    width: 100%;
    height: 40px;
    border-radius: var(--osus-radius-base);
    margin-bottom: var(--osus-space-1);
    border: 1px solid var(--osus-gray-200);
  }
  
  .color-option small {
    font-size: var(--osus-text-xs);
    color: var(--osus-gray-600);
    font-weight: 500;
  }
  
  /* Shopping List */
  .shopping-list {
    max-height: 200px;
    overflow-y: auto;
    background: var(--osus-sand-light);
    border-radius: var(--osus-radius-md);
    padding: var(--osus-space-3);
  }
  
  .shopping-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--osus-space-2);
    background: white;
    border-radius: var(--osus-radius-base);
    margin-bottom: var(--osus-space-2);
    border: 1px solid var(--osus-gray-200);
  }
  
  .shopping-item:last-child {
    margin-bottom: 0;
  }
  
  .shopping-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--osus-radius-base);
    margin-left: var(--osus-space-2);
  }
  
  .shopping-item-info {
    flex: 1;
    margin-left: var(--osus-space-2);
  }
  
  .shopping-item-info h6 {
    font-size: var(--osus-text-sm);
    font-weight: 500;
    margin-bottom: var(--osus-space-1);
    line-height: 1.2;
  }
  
  .shopping-item-info .price {
    font-size: var(--osus-text-sm);
    color: var(--osus-primary);
    font-weight: 600;
  }
  
  .shopping-item-actions {
    display: flex;
    align-items: center;
    gap: var(--osus-space-1);
  }
  
  .shopping-summary {
    background: var(--osus-primary);
    color: white;
    padding: var(--osus-space-4);
    border-radius: var(--osus-radius-md);
    margin-top: var(--osus-space-3);
  }
  
  /* Form Controls in Properties Panel */
  .properties-panel .form-control,
  .properties-panel .form-select {
    font-size: var(--osus-text-sm);
    padding: var(--osus-space-2) var(--osus-space-3);
  }
  
  .properties-panel .input-group-text {
    font-size: var(--osus-text-sm);
    background: var(--osus-sand-light);
    border-color: var(--osus-gray-300);
  }
  
  /* ===================================
     MODAL CUSTOMIZATIONS
     =================================== */
  
  .modal-content {
    border-radius: var(--osus-radius-xl);
    border: none;
    box-shadow: var(--osus-shadow-2xl);
  }
  
  .modal-header {
    background: var(--osus-sand-light);
    border-bottom: 1px solid var(--osus-gray-200);
    border-radius: var(--osus-radius-xl) var(--osus-radius-xl) 0 0;
    padding: var(--osus-space-4) var(--osus-space-6);
  }
  
  .modal-title {
    font-weight: 600;
    color: var(--osus-gray-800);
    display: flex;
    align-items: center;
    gap: var(--osus-space-2);
  }
  
  .modal-body {
    padding: var(--osus-space-6);
  }
  
  .modal-footer {
    background: var(--osus-sand-light);
    border-top: 1px solid var(--osus-gray-200);
    border-radius: 0 0 var(--osus-radius-xl) var(--osus-radius-xl);
    padding: var(--osus-space-4) var(--osus-space-6);
  }
  
  /* Template Cards in Modal */
  .template-card {
    border: 1px solid var(--osus-gray-200);
    border-radius: var(--osus-radius-lg);
    overflow: hidden;
    transition: var(--osus-transition-base);
    cursor: pointer;
    background: white;
  }
  
  .template-card:hover {
    border-color: var(--osus-primary);
    box-shadow: var(--osus-shadow-md);
    transform: translateY(-2px);
  }
  
  .template-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
  }
  
  .template-card-body {
    padding: var(--osus-space-3);
  }
  
  .template-card h6 {
    font-size: var(--osus-text-sm);
    font-weight: 600;
    margin-bottom: var(--osus-space-1);
    color: var(--osus-gray-800);
  }
  
  .template-card p {
    font-size: var(--osus-text-xs);
    color: var(--osus-gray-600);
    margin-bottom: var(--osus-space-2);
    line-height: 1.4;
  }
  
  .template-card .badge {
    font-size: var(--osus-text-xs);
  }
  
  /* ===================================
     RESPONSIVE DESIGN
     =================================== */
  
  /* Mobile Devices */
  @media (max-width: 768px) {
    .design-studio-container {
      height: auto;
      min-height: 100vh;
    }
    
    .design-main-area .row {
      flex-direction: column;
      height: auto;
    }
    
    .design-sidebar {
      position: fixed;
      top: 80px;
      left: -100%;
      width: 280px;
      height: calc(100vh - 80px);
      z-index: var(--osus-z-modal);
      transition: var(--osus-transition-base);
    }
    
    .design-sidebar.show {
      left: 0;
    }
    
    .design-canvas-container {
      height: 50vh;
      min-height: 400px;
    }
    
    .properties-panel {
      position: fixed;
      bottom: -100%;
      left: 0;
      right: 0;
      height: 60vh;
      max-height: none;
      z-index: var(--osus-z-modal);
      transition: var(--osus-transition-base);
    }
    
    .properties-panel.show {
      bottom: 0;
    }
    
    .canvas-controls {
      bottom: var(--osus-space-2);
      right: var(--osus-space-2);
    }
    
    .room-boundaries {
      width: 90%;
      height: 70%;
    }
    
    .color-palette {
      grid-template-columns: repeat(4, 1fr);
    }
    
    .shopping-list {
      max-height: 150px;
    }
  }
  
  /* Tablet Devices */
  @media (min-width: 768px) and (max-width: 1024px) {
    .design-sidebar {
      max-width: 250px;
    }
    
    .properties-panel {
      max-width: 250px;
    }
    
    .product-grid {
      max-height: calc(100vh - 450px);
    }
    
    .room-boundaries {
      width: 500px;
      height: 380px;
    }
  }
  
  /* Large Screens */
  @media (min-width: 1200px) {
    .design-sidebar {
      max-width: 320px;
    }
    
    .properties-panel {
      max-width: 320px;
    }
    
    .room-boundaries {
      width: 700px;
      height: 500px;
    }
  }
  
  /* ===================================
     TOUCH DEVICE OPTIMIZATIONS
     =================================== */
  
  @media (hover: none) and (pointer: coarse) {
    .product-item {
      padding: var(--osus-space-4);
    }
    
    .category-header {
      padding: var(--osus-space-3);
    }
    
    .btn-icon {
      width: 44px;
      height: 44px;
    }
    
    .canvas-controls {
      padding: var(--osus-space-4);
    }
    
    .furniture-item {
      touch-action: manipulation;
    }
  }
  
  /* ===================================
     ANIMATION CLASSES
     =================================== */
  
  .fade-in {
    animation: fadeIn 0.3s ease-out;
  }
  
  .slide-in-right {
    animation: slideInRight 0.3s ease-out;
  }
  
  .slide-in-left {
    animation: slideInLeft 0.3s ease-out;
  }
  
  .slide-up {
    animation: slideUp 0.3s ease-out;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  @keyframes slideInRight {
    from {
      transform: translateX(100%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
  
  @keyframes slideInLeft {
    from {
      transform: translateX(-100%);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
  
  @keyframes slideUp {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  /* ===================================
     LOADING STATES
     =================================== */
  
  .loading-skeleton {
    background: linear-gradient(90deg, 
      var(--osus-gray-200) 25%, 
      var(--osus-gray-100) 50%, 
      var(--osus-gray-200) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
  }
  
  @keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
  
  .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--osus-gray-200);
    border-top: 2px solid var(--osus-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  /* ===================================
     ACCESSIBILITY ENHANCEMENTS
     =================================== */
  
  .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
  
  .focus-ring:focus {
    outline: 2px solid var(--osus-primary);
    outline-offset: 2px;
  }
  
  /* High contrast mode support */
  @media (prefers-contrast: high) {
    .design-canvas {
      background: white;
    }
    
    .room-svg rect,
    .room-svg path {
      stroke: black !important;
      stroke-width: 2px !important;
    }
    
    .product-item {
      border: 2px solid black;
    }
  }