/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: #2f3136;
  color: #dcddde;
  overflow: hidden;
  user-select: none;
}

/* Main container */
.image-viewer-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #36393f;
  border: 1px solid #202225;
}

/* Custom Title Bar */
.title-bar {
  height: 32px;
  background: #202225;
  border-bottom: 1px solid #40444b;
  display: flex;
  align-items: center;
  padding: 0 8px;
  -webkit-app-region: drag;
  cursor: move;
}

.title-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 100%;
}

.title-bar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #dcddde;
}

.title-bar-title svg {
  width: 16px;
  height: 16px;
  color: #7289da;
}

.title-bar-controls {
  display: flex;
  gap: 2px;
  -webkit-app-region: no-drag;
}

.title-bar-btn {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: #dcddde;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.title-bar-btn:hover {
  background: #40444b;
}

.title-bar-btn.close-btn:hover {
  background: #ed4245;
  color: #ffffff;
}

.title-bar-btn svg {
  width: 14px;
  height: 14px;
}

/* Image Content Area */
.image-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2f3136;
  position: relative;
  overflow: hidden;
}

.image-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: #b9bbbe;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #40444b;
  border-top: 3px solid #7289da;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 14px;
  font-weight: 500;
}

.image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.image-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #b9bbbe;
  text-align: center;
}

.error-icon {
  font-size: 48px;
}

.error-text {
  font-size: 16px;
  font-weight: 500;
  color: #ed4245;
}

.error-filename {
  font-size: 12px;
  color: #72767d;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Resize Handles */
.resize-handle {
  position: absolute;
  background: transparent;
  z-index: 1000;
}

.resize-handle-n {
  top: 0;
  left: 8px;
  right: 8px;
  height: 4px;
  cursor: n-resize;
}

.resize-handle-s {
  bottom: 0;
  left: 8px;
  right: 8px;
  height: 4px;
  cursor: s-resize;
}

.resize-handle-e {
  top: 8px;
  right: 0;
  bottom: 8px;
  width: 4px;
  cursor: e-resize;
}

.resize-handle-w {
  top: 8px;
  left: 0;
  bottom: 8px;
  width: 4px;
  cursor: w-resize;
}

.resize-handle-ne {
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  cursor: ne-resize;
}

.resize-handle-nw {
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  cursor: nw-resize;
}

.resize-handle-se {
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  cursor: se-resize;
}

.resize-handle-sw {
  bottom: 0;
  left: 0;
  width: 8px;
  height: 8px;
  cursor: sw-resize;
}

/* Hover effects for resize handles */
.resize-handle:hover {
  background: rgba(114, 137, 218, 0.3);
}

/* Responsive adjustments */
@media (max-width: 400px) {
  .title-bar-title span {
    display: none;
  }

  .image-container {
    padding: 8px;
  }
}
