:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --dark: #000000;
    --dark-lighter: #1e1e1e;
    --dark-lightest: #374151;
    --gray-light: #9ca3af;
    --white: #ffffff;
    --accent: #0062ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
  }
  
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: black;
    margin: 0;
    min-height: 100vh;
    color: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
  }
  
  .app-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: 
      "header header"
      "sidebar workspace";
    width: 100%;
    max-width: 1400px;
    min-height: 90vh;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
  }
  
  @keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
  }
  
  .toolbar {
    grid-area: header;
    background: linear-gradient(90deg, var(--dark) 0%, var(--dark-lighter) 100%);
    padding: 18px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
  }
  
  .logo {
    /* background: linear-gradient(45deg, var(--primary), var(--accent)); */
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(59, 131, 246, 0.517);
  }
  
  .toolbar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    /* background: linear-gradient(to right, var(--primary-light), var(--accent)); */
    /* -webkit-background-clip: text; */
    /* -webkit-text-fill-color: transparent; */
    margin: 0;
  }
  
  .toolbar-actions {
    display: flex;
    gap: 15px;
  }
  
  .toolbar-button {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    /* border-radius: 8px; */
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .toolbar-button:hover {
    background: rgba(255, 255, 255, 0.2);
  }
  
  .sidebar {
    grid-area: sidebar;
    background: var(--dark);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    overflow-y: auto;
  }
  
  .panel {
    background: var(--dark-lighter);
    /* border-radius: 12px; */
    overflow: hidden;
    transition: all 0.3s ease;
  }
  
  .panel-header {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  .panel-content {
    padding: 15px;
  }
  
  .upload-area {
    position: relative;
    padding: 10px 10px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    /* border-radius: 10px; */
    text-align: center;
  
    transition: all 0.3s ease;
    overflow: hidden;
  }
  
  .upload-area:hover {
    border-color: var(--primary-light);
    background: rgba(59, 130, 246, 0.1);
  }
  
  .upload-icon {
    font-size: 2rem;
    color: var(--primary-light);
    margin-bottom: 10px;
  }
  
  .upload-text {
    font-size: 0.9rem;
    color: var(--gray-light);
    margin-bottom: 8px;
  }
  
  .upload-hint {
    font-size: 0.8rem;
    color: var(--gray-light);
    opacity: 0.7;
  }
  
  #imageUpload {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;

  }
  
  .edit-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }
  
  .input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  
  .input-label {
    font-size: 0.85rem;
    color: var(--gray-light);
    font-weight: 500;
  }
  
  #editInstructions {
    width: 100%;
    height: 150px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* border-radius: 8px; */
    resize: none;
    outline: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
  }
  
  #editInstructions:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  }
  
  #editInstructions::placeholder {
    color: rgba(255, 255, 255, 0.3);
  }
  
  
  #editButton {
    padding: 13px 24px;
    width: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    color: var(--white);
    border: none;
    /* border-radius: 8px; */
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
  }
  
  #editButton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: all 0.3s ease;
  }
  
  #editButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(37, 99, 235, 0.25);
  }
  
  #editButton:hover::before {
    left: 100%;
  }
  
  .workspace {
    grid-area: workspace;
    background: var(--dark-lighter);
    padding: 25px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  
  .workspace-tabs {
    display: flex;
    gap: 3px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
  }
  
  .workspace-tab {
    padding: 10px 20px;
    background: transparent;
    color: var(--gray-light);
    border: none;
    /* border-radius: 8px 8px 0 0; */
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
  }
  
  .workspace-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
  }
  
  #imageDisplay {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    width: 100%;
  }
  
  .image-container {
    background: var(--dark);
    /* border-radius: 12px; */
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 450px;
  }
  
  .image-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
  }
  
  .image-header {
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  .image-title {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .image-content {
    flex: 1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
  }
  
  .image-placeholder {
    color: var(--gray-light);
    font-size: 0.9rem;
    text-align: center;
  }
  
  .image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
    /* border-radius: 4px; */
    transition: all 0.5s ease;
  }
  
  .image-footer {
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  .image-actions {
    display: flex;
    gap: 10px;
  }
  
  .action-button {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: none;
    /* border-radius: 6px; */
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  
  .action-button:hover {
    background: rgba(255, 255, 255, 0.2);
  }
  
  .action-button i {
    font-size: 0.9rem;
  }
  
  #downloadButton {
    background: var(--success);
  }
  
  #downloadButton:hover {
    background: #13db60;
  }
  
  .toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .toggle-wrapper {
    position: relative;
  }
  
  #useAsInputToggle {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  .toggle-label {
    display: inline-block;
    width: 44px;
    height: 22px;
    background: rgba(255, 255, 255, 0.241);
    border-radius: 22px;
    position: relative;
    transition: all 0.3s ease;
    /* box-shadow: 1px 1px 1px rgba(0, 0, 0, 1) inset; */
  }
  
  .toggle-label::after {
    content: '';
    width: 18px;
    height: 18px;
    background: var(--white);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    
  }
  
  #useAsInputToggle:checked + .toggle-label {
    background: var(--primary);
  }
  
  #useAsInputToggle:checked + .toggle-label::after {
    transform: translateX(22px);
  }
  
  .toggle-text {
    font-size: 0.85rem;
    color: var(--gray-light);
  }
  
  #textResponse {
    margin-top: 25px;
    background: var(--dark);
    /* border-radius: 12px; */
    padding: 20px;
    font-size: 0.95rem;
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: none;
  }
  
  .progress-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
  }
  
  .progress-container {
    width: 350px;
    background: var(--dark);
    padding: 30px;
    
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: fadeIn 0.3s ease;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
  }
  
  .progress-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
  }
  
  .progress-icon {
    width: 48px;
    height: 48px;
    /* border-radius: 12px; */
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    animation: pulse 1.5s infinite;
  }
  
  .progress-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 5px;
  }
  
  .progress-subtitle {
    font-size: 0.9rem;
    color: var(--gray-light);
  }
  
  .progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    /* border-radius: 6px; */
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
  }
  
  .progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    transition: width 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
  }
  
  .progress-status {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
  }
  
  .progress-text {
    color: var(--white);
  }
  
  .progress-percentage {
    color: var(--primary-light);
    font-weight: 600;
  }
  
  /* Responsive Styles */
  @media (max-width: 1200px) {
    .app-container {
      grid-template-columns: 280px 1fr;
      max-width: 90vw;
    }
  }
  
  @media (max-width: 900px) {
    .app-container {
      grid-template-columns: 1fr;
      grid-template-rows: auto auto 1fr;
      grid-template-areas: 
        "header"
        "sidebar"
        "workspace";
      max-width: 95vw;
      min-height: 95vh;
    }
    
    .sidebar {
      border-right: none;
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
      padding: 15px;
    }
    
    .toolbar {
      padding: 15px;
    }
    
    .toolbar-actions {
      display: none;
    }
    
    .workspace {
      padding: 15px;
    }
    
    .upload-area {
      padding: 20px 15px;
    }
    
    #imageDisplay {
      grid-template-columns: 1fr;
    }
    
    .image-container {
      height: auto;
      max-height: 400px;
    }
  }
  
  @media (max-width: 600px) {
    .app-container {
      grid-template-rows: auto auto 1fr;
      border-radius: 0;
      max-width: 100vw;
      min-height: 100vh;
    }
    
    .toolbar {
      padding: 12px;
    }
    
    .toolbar button{
        display: block;
    }
    
    .logo {
      width: 32px;
      height: 32px;
    }
    
    .toolbar h1 {
      font-size: 1.2rem;
    }
    
    .sidebar {
      padding: 10px;
    }
    
    .panel {
      border-radius: 8px;
    }
    
    .panel-header {
      padding: 12px;
    }
    
    .panel-content {
      padding: 12px;
    }
    
    .workspace {
      padding: 10px;
    }
    
    .workspace-tabs {
      overflow-x: auto;
      padding-bottom: 5px;
    }
    
    .workspace-tab {
      padding: 8px 15px;
      white-space: nowrap;
    }
    
    #editButton {
      padding: 12px 20px;
    }
  }