/* Image Compressor Pro - Consistent with TriTool Nexus design */

:root {
  --bg: #0b0b0f;
  --card-bg: linear-gradient(180deg, rgba(20, 14, 28, 0.48), rgba(12, 8, 18, 0.6));
  --card-border: rgba(255, 255, 255, 0.03);
  --accent-cyan: #39d9ff;
  --accent-purple: #7c3aed;
  --accent-magenta: #ff4ecf;
  --accent-mid: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple), var(--accent-magenta));
  --text: #e6e6ee;
  --muted: #cfcbe1;
}

* {
  box-sizing: border-box;
  font-family: 'Inter', Arial, sans-serif;
}

body {
  background: var(--bg);
  margin: 0;
  padding: 28px;
  color: var(--text);
}

.tool-container {
  max-width: 820px;
  margin: 18px auto;
  padding: 20px;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--card-border);
  box-shadow: 0 18px 48px rgba(2, 6, 23, 0.55);
}

.tool-header {
  margin-bottom: 28px;
}

.tool-header h1 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 800;
  background: var(--accent-mid);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  padding: 6px 12px;
  background: linear-gradient(180deg, rgba(57, 217, 255, 0.1), rgba(124, 58, 237, 0.08));
  border: 1px solid rgba(57, 217, 255, 0.2);
  border-radius: 999px;
  font-size: 12px;
  color: #cfcbe1;
  font-weight: 600;
}

/* Upload Section */
.uploader {
  margin-bottom: 28px;
}

.drop-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  border: 2px dashed rgba(57, 217, 255, 0.3);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(57, 217, 255, 0.05) 0%, rgba(124, 58, 237, 0.05) 100%);
  transition: all 0.3s ease;
  cursor: pointer;
}

.drop-area:hover {
  border-color: rgba(57, 217, 255, 0.6);
  background: linear-gradient(135deg, rgba(57, 217, 255, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
}

.drop-area p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.controls label {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.controls input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  outline: none;
  -webkit-appearance: none;
}

.controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(90deg, #39d9ff, #7c3aed, #ff4ecf);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.controls input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(90deg, #39d9ff, #7c3aed, #ff4ecf);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  border: none;
}

.controls select {
  /* modern custom-styled select */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  padding: 10px 40px 10px 12px; /* room for custom arrow */
  background-color: transparent;
  background-image: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%23cfcbe1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: right 12px center, center center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.controls select:hover {
  border-color: rgba(57, 217, 255, 0.4);
  box-shadow: 0 6px 18px rgba(57,217,255,0.05);
  background-image: linear-gradient(180deg, rgba(57, 217, 255, 0.04), rgba(124, 58, 237, 0.02)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%23cfcbe1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.controls select:focus {
  outline: none;
  border-color: rgba(57,217,255,0.7);
  box-shadow: 0 8px 30px rgba(57,217,255,0.08), 0 0 0 3px rgba(57,217,255,0.06);
}

/* RTL support: place arrow on the left when body is RTL */
body.rtl .controls select {
  padding: 10px 12px 10px 40px;
  background-position: left 12px center, center center;
}

.controls select option {
  color: var(--text);
  background: linear-gradient(180deg, rgba(20, 14, 28, 0.9), rgba(12, 8, 18, 0.95));
}

/* Faux select (custom dropdown) */
.faux-select {
  position: relative;
  width: 100%;
}
.faux-select__button {
  width: 100%;
  padding: 10px 40px 10px 12px;
  background: linear-gradient(180deg, rgba(20,14,28,0.4), rgba(12,8,18,0.5));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.faux-select__button:focus {
  outline: none;
  box-shadow: 0 8px 30px rgba(57,217,255,0.06);
}
.faux-select__chev {
  width: 16px; height: 16px; opacity: .9; flex: 0 0 16px;
}
.faux-select__list {
  position: absolute;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: linear-gradient(180deg, rgba(12,8,18,0.98), rgba(20,14,28,0.99));
  border: 1px solid rgba(57,217,255,0.06);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(2,6,23,0.7);
  list-style: none;
  padding: 8px;
  display: none;
  z-index: 60;
  max-height: 220px;
  overflow: auto;
}
.faux-select__list.open { display: block; }
.faux-select__list li {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}
.faux-select__list li:hover, .faux-select__list li[aria-selected="true"] {
  background: linear-gradient(90deg, rgba(57,217,255,0.06), rgba(124,58,237,0.04));
  color: var(--text);
}
body.rtl .faux-select__button { direction: rtl }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn:hover:not(:disabled) {
  border-color: rgba(57, 217, 255, 0.4);
  background: linear-gradient(180deg, rgba(57, 217, 255, 0.08), rgba(57, 217, 255, 0.04));
}

.btn.primary {
  background: linear-gradient(90deg, #39d9ff, #7c3aed, #ff4ecf);
  border: none;
  color: #fff;
  box-shadow: 0 10px 36px rgba(124, 58, 237, 0.2);
}

.btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 15px 48px rgba(124, 58, 237, 0.3);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Previews Section */
.previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.preview-card {
  padding: 20px;
  background: linear-gradient(180deg, rgba(20, 14, 28, 0.48), rgba(12, 8, 18, 0.6));
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.preview-img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  width: 100%;
}

.meta span {
  font-size: 13px;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
}

.status {
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(57, 217, 255, 0.1), rgba(124, 58, 237, 0.08));
  border-left: 3px solid #39d9ff;
  border-radius: 6px;
  color: #cfcbe1;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  min-height: 20px;
}

#download-btn {
  width: 100%;
}

/* Trust Message */
.trust {
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(57, 217, 255, 0.05), rgba(124, 58, 237, 0.04));
  border: 1px solid rgba(57, 217, 255, 0.15);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 16px;
  }

  .tool-container {
    padding: 16px;
    margin: 0;
  }

  .previews {
    grid-template-columns: 1fr;
  }

  .drop-area {
    padding: 24px;
  }

  .controls {
    gap: 12px;
  }

  .actions {
    width: 100%;
  }
}
