* {

      box-sizing: border-box;

      margin: 0;

      padding: 0;

    }



    :root {

      --primary: #6d5dfc;

      --primary-dark: #5546df;

      --secondary: #f1efff;

      --background: #f7f8fc;

      --card: #ffffff;

      --text: #15171f;

      --muted: #737785;

      --border: #e6e8ef;

      --success: #159447;

      --danger: #d93025;

      --shadow: 0 14px 40px rgba(24, 30, 52, 0.08);

    }



    body {

      min-height: 100vh;

      background: var(--background);

      color: var(--text);

      font-family:

        Inter, system-ui, -apple-system, BlinkMacSystemFont,

        "Segoe UI", sans-serif;

    }



    button,

    input,

    select,

    textarea {

      font: inherit;

    }



    button {

      cursor: pointer;

    }



    .app {

      display: grid;

      grid-template-columns: 250px 1fr;

      min-height: 100vh;

    }



    .sidebar {

      position: fixed;

      inset: 0 auto 0 0;

      width: 250px;

      padding: 26px 18px;

      background: #10111a;

      color: white;

      z-index: 10;

    }



    .brand {

      padding: 0 10px 26px;

      font-size: 24px;

      font-weight: 800;

      letter-spacing: -0.7px;

    }



    .brand span {

      color: #9187ff;

    }



    .nav-label {

      margin: 18px 12px 9px;

      color: #7f8391;

      font-size: 11px;

      font-weight: 700;

      letter-spacing: 1px;

      text-transform: uppercase;

    }



    .nav-link {

      display: flex;

      align-items: center;

      gap: 12px;

      margin-bottom: 7px;

      padding: 13px 14px;

      border-radius: 12px;

      color: #c9cbd4;

      text-decoration: none;

      transition: 0.2s;

    }



    .nav-link:hover,

    .nav-link.active {

      background: rgba(109, 93, 252, 0.18);

      color: white;

    }



    .sidebar-bottom {

      position: absolute;

      bottom: 24px;

      left: 18px;

      right: 18px;

    }



    .credit-box {

      padding: 16px;

      border: 1px solid rgba(255, 255, 255, 0.12);

      border-radius: 15px;

      background: rgba(255, 255, 255, 0.06);

    }



    .credit-label {

      margin-bottom: 6px;

      color: #aaaeba;

      font-size: 12px;

    }



    .credit-value {

      font-size: 24px;

      font-weight: 800;

    }



    .main {

      grid-column: 2;

      width: calc(100vw - 250px);

      min-height: 100vh;

    }



    .topbar {

      position: sticky;

      top: 0;

      z-index: 8;

      display: flex;

      align-items: center;

      justify-content: space-between;

      height: 78px;

      padding: 0 34px;

      border-bottom: 1px solid var(--border);

      background: rgba(255, 255, 255, 0.9);

      backdrop-filter: blur(12px);

    }



    .page-title h1 {

      font-size: 22px;

      letter-spacing: -0.4px;

    }



    .page-title p {

      margin-top: 3px;

      color: var(--muted);

      font-size: 13px;

    }



    .account-area {

      display: flex;

      align-items: center;

      gap: 12px;

    }



    .avatar {

      display: grid;

      width: 40px;

      height: 40px;

      place-items: center;

      border-radius: 50%;

      background: var(--secondary);

      color: var(--primary);

      font-weight: 800;

    }



    .logout-button {

      padding: 10px 15px;

      border: 1px solid var(--border);

      border-radius: 10px;

      background: white;

      color: var(--text);

    }



    .logout-button:hover {

      background: #f4f5f8;

    }



    .content {

      max-width: 1480px;

      margin: auto;

      padding: 30px 34px 60px;

    }



    .studio-layout {

      display: grid;

      grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);

      gap: 24px;

      align-items: start;

    }



    .card {

      border: 1px solid var(--border);

      border-radius: 20px;

      background: var(--card);

      box-shadow: var(--shadow);

    }



    .controls-card {

      padding: 24px;

    }



    .section-heading {

      margin-bottom: 18px;

    }



    .section-heading h2 {

      font-size: 18px;

    }



    .section-heading p {

      margin-top: 5px;

      color: var(--muted);

      font-size: 13px;

      line-height: 1.5;

    }



    .upload-zone {

      position: relative;

      display: grid;

      min-height: 225px;

      place-items: center;

      padding: 20px;

      overflow: hidden;

      border: 2px dashed #cfd2de;

      border-radius: 16px;

      background: #fafafe;

      text-align: center;

      transition: 0.2s;

    }



    .upload-zone.dragging {

      border-color: var(--primary);

      background: var(--secondary);

    }



    .upload-zone.has-image {

      border-style: solid;

    }



    .upload-zone input {

      display: none;

    }



    .upload-icon {

      display: grid;

      width: 55px;

      height: 55px;

      margin: 0 auto 12px;

      place-items: center;

      border-radius: 16px;

      background: var(--secondary);

      color: var(--primary);

      font-size: 25px;

    }



    .upload-zone h3 {

      margin-bottom: 5px;

      font-size: 15px;

    }



    .upload-zone p {

      color: var(--muted);

      font-size: 12px;

      line-height: 1.5;

    }



    .browse-button {

      display: inline-block;

      margin-top: 14px;

      padding: 9px 15px;

      border-radius: 9px;

      background: var(--primary);

      color: white;

      font-size: 13px;

      font-weight: 700;

    }



    .upload-preview {

      width: 100%;

      max-height: 260px;

      border-radius: 12px;

      object-fit: contain;

    }



    .replace-image {

      position: absolute;

      top: 12px;

      right: 12px;

      padding: 8px 11px;

      border: 0;

      border-radius: 8px;

      background: rgba(0, 0, 0, 0.7);

      color: white;

      font-size: 12px;

    }



    .form-grid {

      display: grid;

      gap: 16px;

      margin-top: 22px;

    }



    .field label {

      display: block;

      margin-bottom: 7px;

      color: #373b48;

      font-size: 13px;

      font-weight: 700;

    }



    .field select,

    .field textarea,

    .field input {

      width: 100%;

      border: 1px solid var(--border);

      border-radius: 11px;

      background: white;

      color: var(--text);

      outline: none;

      transition: 0.2s;

    }



    .field select,

    .field input {

      height: 46px;

      padding: 0 13px;

    }



    .field textarea {

      min-height: 95px;

      padding: 12px 13px;

      resize: vertical;

      line-height: 1.5;

    }



    .field select:focus,

    .field textarea:focus,

    .field input:focus {

      border-color: var(--primary);

      box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.1);

    }


    .generate-button {

      display: flex;

      width: 100%;

      height: 52px;

      align-items: center;

      justify-content: center;

      gap: 9px;

      margin-top: 22px;

      border: 0;

      border-radius: 12px;

      background: linear-gradient(135deg, var(--primary), #895dfa);

      color: white;

      font-weight: 800;

      box-shadow: 0 12px 25px rgba(109, 93, 252, 0.25);

    }



    .generate-button:hover {

      transform: translateY(-1px);

    }



    .generate-button:disabled {

      cursor: not-allowed;

      opacity: 0.65;

      transform: none;

    }



    .spinner {

      width: 19px;

      height: 19px;

      border: 2px solid rgba(255, 255, 255, 0.4);

      border-top-color: white;

      border-radius: 50%;

      animation: spin 0.8s linear infinite;

    }



    @keyframes spin {

      to {

        transform: rotate(360deg);

      }

    }



    .result-card {

      min-height: 650px;

      overflow: hidden;

    }



    .result-header {

      display: flex;

      align-items: center;

      justify-content: space-between;

      padding: 21px 24px;

      border-bottom: 1px solid var(--border);

    }



    .result-header h2 {

      font-size: 18px;

    }



    .result-actions {

      display: flex;

      gap: 9px;

    }



    .action-button {

      display: none;

      padding: 9px 13px;

      border: 1px solid var(--border);

      border-radius: 9px;

      background: white;

      color: var(--text);

      text-decoration: none;

      font-size: 13px;

      font-weight: 700;

    }



    .action-button.primary {

      border-color: var(--primary);

      background: var(--primary);

      color: white;

    }



    .result-body {

      display: grid;

      min-height: 588px;

      place-items: center;

      padding: 25px;

      background:

        linear-gradient(45deg, #f6f6fa 25%, transparent 25%),

        linear-gradient(-45deg, #f6f6fa 25%, transparent 25%),

        linear-gradient(45deg, transparent 75%, #f6f6fa 75%),

        linear-gradient(-45deg, transparent 75%, #f6f6fa 75%);

      background-position:

        0 0,

        0 10px,

        10px -10px,

        -10px 0;

      background-size: 20px 20px;

    }



    .empty-result {

      max-width: 380px;

      padding: 20px;

      text-align: center;

    }



    .empty-result-icon {

      display: grid;

      width: 76px;

      height: 76px;

      margin: 0 auto 18px;

      place-items: center;

      border-radius: 22px;

      background: white;

      color: var(--primary);

      font-size: 32px;

      box-shadow: var(--shadow);

    }



    .empty-result h3 {

      margin-bottom: 8px;

      font-size: 18px;

    }



    .empty-result p {

      color: var(--muted);

      font-size: 14px;

      line-height: 1.6;

    }



    .loading-result {

      display: none;

      text-align: center;

    }



    .loading-circle {

      width: 58px;

      height: 58px;

      margin: 0 auto 18px;

      border: 5px solid #e7e5ff;

      border-top-color: var(--primary);

      border-radius: 50%;

      animation: spin 0.8s linear infinite;

    }



    .loading-result h3 {

      margin-bottom: 7px;

    }



    .loading-result p {

      color: var(--muted);

      font-size: 13px;

    }



    .generated-image {

      display: none;

      max-width: 100%;

      max-height: 550px;

      border-radius: 14px;

      background: white;

      box-shadow: 0 20px 55px rgba(15, 20, 40, 0.18);

      object-fit: contain;

    }



    .status-message {

      display: none;

      margin-top: 14px;

      padding: 12px 14px;

      border-radius: 10px;

      font-size: 13px;

      line-height: 1.5;

    }



    .status-message.success {

      display: block;

      background: #eaf8ef;

      color: var(--success);

    }



    .status-message.error {

      display: block;

      background: #fdeeed;

      color: var(--danger);

    }



    .history-section {

      margin-top: 28px;

    }



    .history-title {

      display: flex;

      align-items: center;

      justify-content: space-between;

      margin-bottom: 15px;

    }



    .history-title h2 {

      font-size: 19px;

    }



    .refresh-button {

      padding: 9px 13px;

      border: 1px solid var(--border);

      border-radius: 9px;

      background: white;

    }



    .history-grid {

      display: grid;

      grid-template-columns: repeat(4, minmax(0, 1fr));

      gap: 16px;

    }



    .history-item {

      overflow: hidden;

      border: 1px solid var(--border);

      border-radius: 15px;

      background: white;

      box-shadow: 0 8px 25px rgba(20, 25, 45, 0.05);

    }



    .history-image-wrap {

      display: grid;

      height: 190px;

      place-items: center;

      overflow: hidden;

      background: #f5f5f8;

    }



    .history-image {

      width: 100%;

      height: 100%;

      object-fit: cover;

    }



    .history-info {

      padding: 13px;

    }



    .history-info h4 {

      overflow: hidden;

      margin-bottom: 6px;

      text-overflow: ellipsis;

      white-space: nowrap;

      font-size: 14px;

      text-transform: capitalize;

    }



    .history-info p {

      color: var(--muted);

      font-size: 12px;

    }



    .history-empty {

      grid-column: 1 / -1;

      padding: 45px 20px;

      border: 1px dashed var(--border);

      border-radius: 15px;

      background: white;

      color: var(--muted);

      text-align: center;

    }



    @media (max-width: 1100px) {

      .studio-layout {

        grid-template-columns: 1fr;

      }



      .history-grid {

        grid-template-columns: repeat(3, minmax(0, 1fr));

      }

    }



    @media (max-width: 800px) {

      .app {

        display: block;

      }



      .sidebar {

        display: none;

      }



      .main {

        width: 100%;

      }



      .topbar {

        height: auto;

        padding: 17px 18px;

      }



      .page-title p {

        display: none;

      }



      .account-name {

        display: none;

      }



      .content {

        padding: 20px 16px 45px;

      }



      .history-grid {

        grid-template-columns: repeat(2, minmax(0, 1fr));

      }

    }



    @media (max-width: 520px) {

      .history-grid {

        grid-template-columns: 1fr;

      }



      .result-header {

        align-items: flex-start;

        gap: 14px;

      }



      .result-actions {

        flex-direction: column;

      }



      .result-card {

        min-height: 520px;

      }



      .result-body {

        min-height: 450px;

      }

    }

.comparison-container{

    position:relative;

    width:100%;

    max-width:800px;

    margin:30px auto;

    overflow:hidden;

    border-radius:16px;

    background:#fff;

}



.comparison-base-image,

.comparison-generated-image{

    display:block;

    width:100%;

    height:auto;

}



.comparison-overlay{

    position:absolute;

    top:0;

    left:0;

    width:50%;

    height:100%;

    overflow:hidden;

}



.comparison-generated-image{

    width:100%;

}



.comparison-divider{

    position:absolute;

    top:0;

    left:50%;

    transform:translateX(-50%);

    width:3px;

    height:100%;

    background:#ffffff;

    box-shadow:0 0 10px rgba(0,0,0,.3);

    pointer-events:none;

}



.comparison-slider{

    width:100%;

    margin-top:20px;

}



.comparison-label{

    position:absolute;

    top:15px;

    background:rgba(0,0,0,.65);

    color:#fff;

    padding:6px 12px;

    border-radius:20px;

    font-size:13px;

    font-weight:600;

}



.comparison-label-left{

    left:15px;

}



.comparison-label-right{

    right:15px;

}



/* ApnaImage Brand Kit integration */



#apnaImageBrandKitPanel {

  position: fixed;

  z-index: 9999;

  right: 18px;

  bottom: 18px;

  display: flex;

  max-width: min(390px, calc(100vw - 36px));

  align-items: center;

  gap: 10px;

  padding: 10px;

  border: 1px solid rgba(109, 93, 252, 0.25);

  border-radius: 14px;

  background: rgba(255, 255, 255, 0.96);

  box-shadow:

    0 16px 38px rgba(24, 25, 38, 0.15);

  backdrop-filter: blur(15px);

}



#applyBrandKitButton {

  min-height: 39px;

  padding: 0 13px;

  border: 0;

  border-radius: 10px;

  background: #6d5dfc;

  color: white;

  font-size: 11px;

  font-weight: 850;

  cursor: pointer;

  white-space: nowrap;

}



#applyBrandKitButton:hover {

  background: #5546de;

}



#applyBrandKitButton:disabled {

  cursor: wait;

  opacity: 0.65;

}



#brandKitStudioStatus {

  color: #717483;

  font-size: 9px;

  font-weight: 700;

  line-height: 1.4;

}



@media (max-width: 620px) {

  #apnaImageBrandKitPanel {

    right: 10px;

    bottom: 10px;

    left: 10px;

    max-width: none;

  }

}

