/* General Reset & Fonts */
body {
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 0;
  background: #f9f9f9;
  color: #333;
  text-align: center;
}

header {
  padding: 50px 20px 20px;
  background: #0077ff;
  color: white;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header h1 {
  margin: 0;
  font-size: 2.2rem;
}

header p {
  margin-top: 10px;
  font-size: 1rem;
}

/* Main Layout */
main {
  padding: 40px 20px;
}

#upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 60px;
}

#upload-box {
  width: 450px; 
  min-height: 300px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 2px dashed #0077ff;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f8faff);
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
}
#upload-box:hover {
  transform: scale(1.02);
  box-shadow: 0px 10px 20px rgba(0,0,0,0.1);
}

#upload-message {
  overflow: hidden;               /* allow height animation */
  height: 0;                      /* start collapsed */
  opacity: 0;
  margin-top: 0;
  background: #ffebee;
  color: #c62828;
  padding: 0 15px;                /* horizontal padding only initially */
  border-radius: 8px;
  font-size: 0.95rem;
  text-align: center;
  transition: height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, margin-top 0.3s ease;
}

#upload-message.show {
  height: 20px;                   /* adjust based on your message text size */
  opacity: 1;
  padding: 10px 15px;             /* full padding when visible */
  margin-top: 10px;                /* spacing between upload box and button */
}


#uploadImage {
  opacity: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  cursor: pointer;
}

#upload-text {
  z-index: 1;
  color: #0077ff;
  cursor: pointer; /* indicates clickability */
  pointer-events: auto;
  text-align: center;
}

#previewImage {
  width: 100%;            /* fill box width */
  height: auto;           /* maintain aspect ratio */
  max-height: 220px;      /* optional cap so it doesn’t overflow */
  margin-top: 10px;
  border-radius: 8px;
  display: none;          /* still hidden until a file is loaded */
  object-fit: contain;    /* scale image nicely without distortion */
}

/* Button */
.primary-btn {
  padding: 15px 50px;
  margin-top: 20px;
  background: linear-gradient(90deg, #0077ff, #005fcc);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.primary-btn:hover {
  background: #005fcc;
}

/* Results Section */
#results-section h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
}

#results {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.result {
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
}
.result:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.result img {
  width: 100%;
  height: auto;        /* keep natural aspect ratio */
  max-height: 250px;   /* caps really tall images */
  border-radius: 8px;
  margin-bottom: 8px;
  object-fit: contain; /* ensures images shrink to fit without distortion */
}
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

footer {
  padding: 20px;
  font-size: 0.85rem;
  color: #666;
  background: #f1f1f1;
}

#upload-box.dragover {
  background: #e6f2ff;
  border-color: #005fcc;
}

#loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7); /* semi-transparent overlay */
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  z-index: 2; /* above everything inside upload box */
}

#loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #0077ff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.hidden { display: none !important; }

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.result:hover {
  transform: translateY(-5px);
  box-shadow: 0px 8px 15px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}
#score-guide {
  background: #f0f4ff;
  border-radius: 12px;
  padding: 20px 30px;
  box-shadow: 0 6px 15px rgba(0,0,0,0.05);
  max-width: 600px;
  margin: 40px auto;
  text-align: left;
}

#score-guide h3 {
  margin-top: 0;
  color: #0077ff;
  font-size: 1.3rem;
  text-align: center;
}

#score-guide ul {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
}

#score-guide li {
  display: flex;
  flex-direction: column; /* stack text above bar */
  margin-bottom: 15px;
}

.score-info {
  font-size: 0.95rem;
  color: #333;
  margin-bottom: 6px;
}

.score-range {
  font-weight: 600;
  margin-right: 5px;
}

.score-bar {
  height: 12px;
  width: 100%;       /* full width for consistency */
  border-radius: 6px;
}

.result-bar {
  display: block;
  height: 8px;
  width: 100%;
  border-radius: 4px;
  margin-top: 6px;
}

/* Colored bars */
.very-poor { background: #e0e0e0; }
.poor { background: #ffb74d; }
.decent { background: #ffd54f; }
.good { background: #4fc3f7; }
.excellent { background: #4caf50; }


@media (max-width: 768px) {
  .primary-btn {
    width: 75%;
    font-size: 1.1rem;
  }
  .result {
    width: 45%; /* smaller cards, 2 per row */
  }
  #upload-box{
    width: 80%;
  }
}
