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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #6a11cb, #2575fc);
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Full-Width Top Bar Header */
.top-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 40px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(15px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1; /* Aligns brand to left */
}

.logo {
  height: 40px;
  width: 40px;
  border-radius: 8px;
  object-fit: cover;
}

.site-name {
  font-size: 1.2rem;
  font-weight: bold;
  letter-spacing: 1px;
}

.nav-links {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.nav-link {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.8);
  padding: 8px 18px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.nav-link.active {
  background: #fff;
  color: #2575fc;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.header-spacer {
  flex: 1; /* Balances the brand section on the right */
}

/* Content Layout */
h1 {
  text-align: center;
  margin: 20px 0 30px 0;
  font-weight: 300;
  letter-spacing: 1px;
}

.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
  width: 100%;
  max-width: 1100px;
  padding: 0 20px;
  margin-bottom: 50px;
}

.upload-area, .result {
  width: 100%;
  min-height: 350px;
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: transform 0.3s ease;
}

.upload-area { border: 3px dashed rgba(255, 255, 255, 0.5); cursor: pointer; }
.upload-area:hover { border-color: #fff; background: rgba(255, 255, 255, 0.15); }
.upload-area.dragover { border-color: #ff6a00; background: rgba(255, 255, 255, 0.25); }

.result { border: 2px solid rgba(255, 255, 255, 0.2); }

/* Elements */
.mobile-hint {
  display: none;
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 10px;
  background: rgba(0,0,0,0.2);
  padding: 5px 12px;
  border-radius: 15px;
}

img, .preview {
  max-width: 100%;
  height: auto;
  max-height: 250px; 
  border-radius: 12px;
  object-fit: contain;
  margin-top: 15px;
}

button, .btn {
  margin-top: 20px;
  padding: 14px 28px;
  border: none;
  border-radius: 30px;
  background: linear-gradient(90deg, #ff6a00, #ee0979);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

button:hover { transform: translateY(-2px); opacity: 0.9; }

/* Feedback & Progress */
.progress {
  margin-top: 20px;
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #00f2fe, #4facfe);
  transition: width 0.3s ease;
}

.spinner-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none; justify-content: center; align-items: center;
  background: rgba(0, 0, 0, 0.6); border-radius: 20px;
}

.spinner {
  border: 5px solid rgba(255, 255, 255, 0.1);
  border-top: 5px solid #fff;
  border-radius: 50%;
  width: 50px; height: 50px;
  animation: spin 1s linear infinite;
}

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

#messageBox {
  margin-top: 15px; padding: 10px; border-radius: 8px;
  display: none; font-size: 0.9rem;
}

#messageBox.success { background: rgba(46, 204, 113, 0.2); color: #2ecc71; }
#messageBox.error { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }

/* Responsive Media Queries */
@media (max-width: 768px) {
  .top-bar { padding: 10px 15px; }
  .site-name, .header-spacer { display: none; }
  .brand { flex: 0; }
  .nav-links { flex: 1; justify-content: center; }
  .container { grid-template-columns: 1fr; }
  .mobile-hint { display: inline-block; }
}