:root {
  --active-color: #2CAEB2;
  --bg-light: #f5f5f5;
  --text-dark: #333;
  --error-color: #F97251;
  --hover-color: #23CACF;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Montserrat', sans-serif;
}

/* Sidebar */
.sidebar {
  width: 340px;
  float: left;
  padding: 20px;
}

.sidebar ul {
  list-style: none;
}

.sidebar li + li {
  margin-top: 10px;
}

.sidebar button {
  width: 300px;
  height: 50px;
  padding: 0 15px;
  background: var(--bg-light);
  color: var(--text-dark);
  border: 2px solid transparent;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s, border 0.2s, color 0.2s;
}

.sidebar button.inactive {
  color: #999;
  cursor: not-allowed;
}

.sidebar button.inactive i {
  color: #999 !important;
}

.sidebar button.inactive:hover {
  border-color: transparent;
  color: #999;
}
.sidebar button:hover {
  border-color: var(--active-color);
  color: var(--active-color);
}

.sidebar button.inactive:hover {
  border-color: transparent;
  color: #999;
}
.sidebar button.active {
  background: var(--active-color);
  color: #fff;
}

.sidebar button i {
  margin-right: 10px;
  color: var(--active-color);
}

.sidebar button.active i {
  color: #fff !important;
}

/* Main area */
.main {
  margin-left: 360px;
  padding: 20px;
}

.drop-area {
  width: 100%;
  height: 50vh;
  border: 6px dashed #C8C8C8;
  border-radius: 16px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.drop-area.circle .cropper-view-box,
.drop-area.circle .cropper-face {
  border-radius: 50% !important;
}

.placeholder i {
  font-size: 48px;
  color: var(--active-color);
}

.cropper-view-box,
.cropper-face {
  outline: 2px dashed var(--active-color) !important;
}

.cropper-point {
  width: 12px !important;
  height: 12px !important;
  background: #fff !important;
  border: 2px solid var(--active-color) !important;
  border-radius: 2px !important;
  margin: -7px !important;
  z-index: 5 !important;
}

.cropper-point.point-se,
.cropper-point.point-sw,
.cropper-point.point-ne,
.cropper-point.point-nw {
  cursor: nwse-resize !important;
}

/* Crop info container */
.crop-info-container {
  display: flex;
  flex-direction: column;
  margin: 5px 0 10px;
  gap: 0;
}

.crop-info-container.side-by-side {
  display: flex;
  flex-direction: row;
  gap: 15px;
  align-items: stretch;
}

/* Dimensions bar */
.dimensions-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px 0;
  background: #F1F1F1;
  border-radius: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dark);
  width: 100%;
  min-height: 50px;
  box-sizing: border-box;
}

.crop-info-container.side-by-side .dimensions-bar {
  flex: 1;
  width: calc(50% - 7.5px);
}

.dimensions-numbers {
  font-weight: bold;
  color: var(--active-color);
}

/* Drawing Tools */
.drawing-tools {
  margin: 5px 0 10px;
  padding: 8px 15px;
  background: #F1F1F1;
  border-radius: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.drawing-btn {
  width: 40px;
  height: 40px;
  background: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.drawing-btn:hover {
  border: 2px solid var(--active-color);
}

.drawing-btn:hover i {
  color: var(--active-color);
}

.drawing-btn.active {
  background: var(--active-color);
  color: white;
}

.drawing-btn.active i {
  color: white;
}

/* Drawing Options */
.drawing-options {
  margin: 5px 0 10px;
  padding: 15px;
  background: #F1F1F1;
  border-radius: 20px;
  position: relative;
}

.close-drawing-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  background: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border 0.2s ease, color 0.2s ease;
}

.close-drawing-btn:hover {
  border: 2px solid var(--active-color);
}

.close-drawing-btn:hover i {
  color: var(--active-color);
}

.drawing-controls-horizontal {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  gap: 20px;
  padding-top: 10px;
}

.drawing-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.group-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dark);
  text-align: center;
  white-space: nowrap;
}

.pen-sizes {
  display: flex;
  gap: 10px;
}

.pen-size-btn {
  width: 35px;
  height: 35px;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease;
}

.pen-size-btn:hover {
  border-color: var(--active-color);
}

.pen-size-btn.active {
  background: var(--active-color);
  border-color: var(--active-color);
  color: white;
}

.pen-size-btn.active i {
  color: white;
}

.color-palette {
  display: flex;
  gap: 8px;
}

.color-btn {
  width: 30px;
  height: 30px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease;
}

.color-btn:hover {
  transform: scale(1.1);
}

.color-btn.active {
  border-color: var(--active-color);
  transform: scale(1.1);
}

.erase-actions {
  display: flex;
}

.drawing-action-btn {
  width: 40px;
  height: 40px;
  background: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border 0.2s ease, color 0.2s ease;
}

.drawing-action-btn:hover {
  border: 2px solid var(--active-color);
}

.drawing-action-btn:hover i {
  color: var(--active-color);
}

#eraseAllBtn:hover {
  border: 2px solid var(--error-color);
}

#eraseAllBtn:hover i {
  color: var(--error-color);
}

/* Preset selector */
.preset-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 15px;
  background: #F1F1F1;
  border-radius: 20px;
  text-align: center;
  min-height: 50px;
  box-sizing: border-box;
  width: calc(50% - 7.5px);
  flex: 1;
}

.preset-bar select {
  width: 100%;
  background: white;
  border: none;
  border-radius: 15px;
  padding: 8px 15px;
  font-size: 12px;
  box-sizing: border-box;
  margin: 0;
}

/* Format selector */
.format-selector {
  margin: 10px 0;
  padding: 15px;
  background: #F1F1F1;
  border-radius: 20px;
}

.format-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 10px;
  text-align: center;
}

.format-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}

.format-dropdown {
  display: none;
  width: 100%;
  background: white !important;
  border: none;
  border-radius: 15px;
  padding: 10px 15px;
  font-size: 14px;
  margin-bottom: 8px;
}
.format-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 15px;
  background-color: white;
  border: 2px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  gap: 6px;
}

.format-option:hover {
  background-color: white;
  border-color: var(--active-color);
}

.format-option.selected {
  background-color: var(--active-color);
  color: white;
  border-color: var(--active-color);
}

.format-option.selected:hover {
  background-color: var(--active-color);
  border-color: var(--active-color);
}

.radio-icon {
  font-size: 18px !important;
  color: #999;
  transition: color 0.2s ease;
}

.format-option.selected .radio-icon {
  color: var(--active-color);
}

.format-option.selected .radio-icon {
  color: white;
}


.format-option span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dark);
  transition: color 0.2s ease;
}

.format-option.selected span {
  color: white;
}

.format-hint {
  font-size: 11px;
  color: #666;
  text-align: center;
  font-style: italic;
  min-height: 14px;
}

/* Mobile format selector hidden on desktop */
.mobile-selector {
  display: none;
}

/* Bottom bar */
.bottom-bar {
  margin-top: 10px;
  background: #F1F1F1;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  background: #fff;
  border: none;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 10px;
  transition: border 0.2s ease, color 0.2s ease;
}

.icon-btn i {
  transition: color 0.2s ease;
}

.icon-btn:hover {
  border: 2px solid var(--active-color);
}

.icon-btn:hover i {
  color: var(--active-color);
}

.crop-btn {
  flex: 1;
  margin: 0 20px;
  padding: 10px 30px;
  border: none;
  border-radius: 30px;
  background: var(--active-color);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s ease;
}

.crop-btn i {
  color: #fff;
  transition: color 0.3s ease;
}

.crop-btn:hover {
  background: var(--hover-color);
}

.crop-btn.inactive {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
}

.crop-btn.inactive i {
    color: #888;
}

.crop-btn.inactive:hover {
    background: #ccc;
}

.download-btn {
    flex: 1;
    margin: 0 20px;
  padding: 10px 20px;
  background: var(--active-color);
  color: #fff;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  display: none;
    align-items: center;
    justify-content: center;
  transition: background 0.3s ease;
}

.download-btn:hover {
  background: var(--hover-color);
}

#clearBtn:hover {
  border: 2px solid var(--error-color);
}

#clearBtn:hover i {
  color: var(--error-color);
}

/* Select styling */
select,
select.mobile-selector,
.preset-bar select,
.format-dropdown {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 15px center !important;
  background-size: 24px !important;
  padding-right: 45px !important;
  border-radius: 30px !important;
}

select,
select.mobile-selector,
.preset-bar select {
  background-color: #F1F1F1 !important;
}

.format-dropdown {
  background-color: white !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    padding: 10px;
  }

  .mobile-selector {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    background: #F1F1F1;
    border: none;
    border-radius: 30px;
    padding: 10px 20px;
    font-size: 14px;
    opacity: 0.6;
  }

  /* Format selector responsive */
  .format-options {
    display: none;
  }
  
  .format-dropdown {
    display: block;
    background: white !important;
  }
  
  /* Drawing controls vertical layout on mobile */
  .drawing-controls-horizontal {
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }
  
  .drawing-group {
    width: 100%;
    max-width: 300px;
  }
  
  .group-title {
    margin-bottom: 10px;
    font-size: 14px;
  }
  
  .pen-sizes {
    justify-content: center;
  }
  
  .color-palette {
    justify-content: center;
  }
  
  .erase-actions {
    justify-content: center;
  }
  .bottom-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .icon-btn {
    width: 100%;
    border-radius: 30px;
    height: 50px;
    margin-bottom: 10px;
  }

  .crop-btn,
  .crop-info-container {
    flex-direction: column;
  }
  
  .crop-info-container.side-by-side {
    flex-direction: column;
  }
  
  .crop-info-container.side-by-side .dimensions-bar,
  .crop-info-container.side-by-side .preset-bar {
    width: 100%;
    margin-bottom: 5px;
  }

  .download-btn,
  #undoBtn,
  #clearBtn {
    width: 100%;
    margin: 5px 0;
    justify-content: center;
  }
}