﻿/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* CSS Variables for Premium Dark Navy & Gold Themed Sub-App */
:root {
  --bg-main: #0d0e10;
  --bg-gradient: radial-gradient(circle at 50% 0%, #291a0d 0%, #0d0e10 80%);
  --panel-bg: rgba(28, 31, 35, 0.75);
  --panel-border: rgba(255, 255, 255, 0.05);
  
  /* Brand Colors matching Portal */
  --primary: #ff9a3c;       /* Gold */
  --primary-hover: #f1cf5d;
  --primary-glow: rgba(232, 131, 58, 0.25);
  
  --secondary: #2563eb;     /* Royal Blue */
  --secondary-glow: rgba(37, 99, 235, 0.25);
  
  --accent: #06b6d4;        /* Cyan */
  --accent-glow: rgba(6, 182, 212, 0.2);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-inverse: #0d0e10;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --error: #ef4444;
  
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-main);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Standalone na Kovačnici — header i hero su vidljivi */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}
.hero h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.hero p { color: var(--text-muted); max-width: 640px; margin: 0 auto; }

h1, h2, h3, h4 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Grid layout for Main App Workspace */
.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
}

/* Glassmorphic Cards (Nested under panel, border set to very faint blue) */
.panel {
  background: var(--panel-bg);
  border: 1px solid rgba(59, 130, 246, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  transition: var(--transition-smooth);
}

.panel:hover {
  border-color: rgba(232, 131, 58, 0.1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Dropzone Styles */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.005);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(232, 131, 58, 0.02);
  box-shadow: inset 0 0 15px rgba(232, 131, 58, 0.05);
}

.dropzone-icon-wrapper {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--primary);
  transition: var(--transition-smooth);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.dropzone:hover .dropzone-icon-wrapper, .dropzone.dragover .dropzone-icon-wrapper {
  transform: translateY(-3px) scale(1.03);
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 6px 20px var(--primary-glow);
  border-color: transparent;
}

.dropzone h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.dropzone p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.btn-select-files {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-select-files:hover {
  background: var(--text-main);
  color: var(--text-inverse);
  transform: translateY(-1px);
}

/* Hidden File Input */
#file-input {
  display: none;
}

/* Settings Controls */
.settings-section-title {
  font-size: 1.05rem;
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.5rem;
}

.settings-section-title i {
  color: var(--primary);
}

.control-group {
  margin-bottom: 1.25rem;
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.control-value {
  color: var(--primary);
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}

/* Format Button Group */
.format-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
  gap: 0.5rem;
}

.format-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  padding: 0.6rem 0.4rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-size: 0.85rem;
}

.format-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.format-btn.active {
  background: linear-gradient(135deg, var(--primary), #b8901c);
  color: var(--text-inverse);
  border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-glow);
  transform: scale(1.02);
}

/* Slider Container */
.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow), 0 0 2px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--primary-hover);
}

/* Dimensions Input Grid */
.dimensions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  outline: none;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.input-wrapper input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 8px var(--primary-glow);
}

.input-unit {
  position: absolute;
  right: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  pointer-events: none;
}

.aspect-lock {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
}

.aspect-lock input {
  accent-color: var(--primary);
}

/* Action Optimize Button */
.btn-optimize-all {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), #b8901c);
  color: var(--text-inverse);
  border: none;
  padding: 0.9rem;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 6px 20px rgba(232, 131, 58, 0.2);
  margin-top: 1.5rem;
}

.btn-optimize-all:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(232, 131, 58, 0.35);
  filter: brightness(1.05);
}

.btn-optimize-all:active {
  transform: translateY(0);
}

.btn-optimize-all:disabled {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}

/* Queue Workspace */
.queue-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.queue-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.queue-count {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}

.btn-clear-all {
  background: transparent;
  border: none;
  color: var(--error);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition-smooth);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.btn-clear-all:hover {
  background: rgba(239, 68, 68, 0.08);
}

/* Empty Queue Illustration */
.empty-queue {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  color: var(--text-muted);
  border: 1px dashed rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.005);
}

.empty-queue-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
  color: var(--primary);
}

/* File Queue card styling */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.file-card {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 50px 1.5fr 1fr auto;
  gap: 1rem;
  align-items: center;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

@media (max-width: 650px) {
  .file-card {
    grid-template-columns: 45px 1fr auto;
    gap: 0.5rem;
  }
  
  .file-meta-stats {
    grid-column: 1 / span 3;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 0.5rem;
  }
}

.file-card:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.05);
}

.file-preview-wrapper {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.file-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-preview-placeholder {
  color: var(--primary);
  font-size: 1.25rem;
}

.file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.15rem;
}

.file-original-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.file-meta-stats {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.size-comparison {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.arrow-right {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.saved-badge {
  background: var(--success-glow);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.15);
  padding: 0.1rem 0.4rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  width: fit-content;
}

.progress-bar-container {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--primary), var(--accent));
  transition: width 0.1s linear;
}

/* Single Card File Actions */
.file-actions {
  display: flex;
  gap: 0.3rem;
}

.btn-file-action {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.btn-file-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.btn-file-action.btn-download-single {
  background: var(--success-glow);
  border-color: rgba(16, 185, 129, 0.08);
  color: var(--success);
}

.btn-file-action.btn-download-single:hover {
  background: var(--success);
  color: var(--text-inverse);
  box-shadow: 0 3px 8px var(--success-glow);
}

.btn-file-action.btn-preview-single {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.1);
  color: var(--accent);
}

.btn-file-action.btn-preview-single:hover {
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: 0 3px 8px var(--accent-glow);
}

.btn-file-action.btn-copy-single {
  background: rgba(232, 131, 58, 0.08);
  border-color: rgba(232, 131, 58, 0.1);
  color: var(--primary);
}

.btn-file-action.btn-copy-single:hover {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 3px 8px var(--primary-glow);
}

.btn-file-action.btn-remove-single:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.15);
}

/* Bulk Download Panel */
.bulk-download-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1rem;
  margin-top: 0.75rem;
}

.bulk-download-stats {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.bulk-saved-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.bulk-saved-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  font-family: 'Outfit', sans-serif;
}

.btn-download-all {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 3px 10px var(--success-glow);
}

.btn-download-all:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--success-glow);
  filter: brightness(1.05);
}

.btn-download-all:active {
  transform: translateY(0);
}

/* Modal and Visual Slider Overlay Styles */
.modal {
  display: none;
  position: fixed;
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  background: rgba(2, 7, 22, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #060b1e;
  border: 1px solid rgba(59, 130, 246, 0.12);
  border-radius: var(--radius-lg);
  padding: 2.2rem 1.75rem 1.75rem 1.75rem;
  max-width: 650px;
  width: 92%;
  position: relative;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(232, 131, 58, 0.05);
  animation: modal-fade-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-fade-in {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 1.25rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.15);
}

/* Image comparison visual slider */
.comparison-slider-container {
  position: relative;
  width: 100%;
  height: 320px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #01040b;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 1.25rem;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 600px) {
  .comparison-slider-container {
    height: 220px;
  }
}

.comparison-slider-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  top: 0;
  left: 0;
}

.comparison-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.comparison-overlay img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.comparison-label {
  position: absolute;
  bottom: 0.75rem;
  background: rgba(2, 7, 22, 0.7);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: white;
  text-transform: uppercase;
  z-index: 5;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'Outfit', sans-serif;
}

.label-original {
  right: 0.75rem;
  border-color: rgba(37, 99, 235, 0.2);
}

.label-optimized {
  left: 0.75rem;
  border-color: rgba(232, 131, 58, 0.2);
}

.comparison-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: white;
  z-index: 10;
  cursor: ew-resize;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.comparison-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: var(--primary);
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), 0 0 8px var(--primary-glow);
  cursor: ew-resize;
  transition: transform 0.1s ease, background-color 0.2s ease;
  color: var(--text-inverse);
}

.comparison-divider:hover .comparison-handle,
.comparison-divider:active .comparison-handle {
  transform: translate(-50%, -50%) scale(1.08);
  background: var(--primary-hover);
}

.comparison-info-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.75rem;
}

.comparison-file-name {
  color: white;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparison-size-diff {
  color: var(--primary);
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
}

/* Toast Alerts (Relative to iframe context) */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: rgba(4, 9, 26, 0.95);
  border-left: 4px solid var(--success);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  animation: toast-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1), toast-fade-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) 2.7s forwards;
}

@keyframes toast-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-fade-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(8px); }
}
