:root{
  --bg:#f4f7fb;
  --card:#ffffff;
  --muted:#6b7280;
  --brand:#2563eb;
  --brand-600:#1e40af;
  --glass: rgba(255,255,255,0.6);
  --radius:12px;
}

/* Make sizing predictable to avoid input overflow */
*, *::before, *::after { box-sizing: border-box; }

html,body{
  height:100%;
}
body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: linear-gradient(180deg, #eef2ff 0%, var(--bg) 100%);
  color: #0f172a;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  margin:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:32px;
}

.container {
  background-color: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(2,6,23,0.08);
  padding: 30px;
  max-width: 1200px;
  margin: 22px auto;
}

/* Main content layout */
#main-content{
  display:block;
}

.app-grid{
  display:grid;
  grid-template-columns: 1fr 360px;
  gap:22px;
  align-items:start;
}

.left-card{
  background:linear-gradient(180deg,#fff,#fbfdff);
  border-radius:16px;
  padding:20px;
  box-shadow: 0 10px 30px rgba(2,6,23,0.05);
}

.right-panel{
  background:linear-gradient(180deg, rgba(37,99,235,0.03), transparent);
  border-radius:12px;
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:stretch;
}

.app-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:10px;
}

.title-wrap h2{ margin:0; display:flex; align-items:center; gap:12px }
.subtitle{ margin:0; color:var(--muted); font-size:13px }

.header-actions{ display:flex; gap:8px; align-items:center }

.meta{ display:flex; flex-direction:column; gap:6px; align-items:flex-start }
.meta .stats{ color:var(--muted); font-size:13px }

.right-panel .upload-actions{ justify-content:flex-start; }

.btn-ghost{ padding:10px 12px; }

.upload-actions{ display:flex; gap:8px; align-items:center }

.btn-ghost{
  background:transparent;
  border:1px solid rgba(15,23,42,0.06);
  color:var(--brand-600);
  padding:10px 12px;
  border-radius:10px;
}

footer{
  margin-top:22px;
  display:flex;
  justify-content:center;
  color:var(--muted);
  font-size:13px;
}

.preview-info{ font-size:13px; color:var(--muted) }

/* Small adjustments for preview area inside left card */
.left-card #preview{ grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap:12px;
  font-size:20px;
  margin:0 0 8px 0;
}

h2 img {
  height:40px;
}

.upload-box {
  border-radius:12px;
  border: 1px dashed rgba(15,23,42,0.06);
  padding: 18px;
  margin-top: 18px;
  background: linear-gradient(180deg, rgba(37,99,235,0.02), transparent);
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:space-between;
}

.upload-button {
  background-color: var(--brand);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items:center;
  gap:10px;
  border:none;
  box-shadow: 0 10px 30px rgba(37,99,235,0.12);
  transition: transform .15s ease, box-shadow .15s ease;
}

.upload-button:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(37,99,235,0.14);
}

/* Toast notifications */
.toast-container{
  position:fixed;
  right:20px;
  bottom:20px;
  display:flex;
  flex-direction:column;
  gap:8px;
  z-index:9999;
}
.toast{
  background:linear-gradient(180deg,#111827,#0f172a);
  color:white;
  padding:10px 14px;
  border-radius:10px;
  box-shadow: 0 10px 30px rgba(2,6,23,0.4);
  font-size:13px;
  opacity:0.98;
}

.download-label{ font-weight:700 }

button {
  background-color: var(--brand);
  color: white;
  border: none;
  padding: 10px 14px;
  margin-top: 10px;
  cursor: pointer;
  border-radius: 10px;
  font-weight:600;
}

button:disabled{
  background: linear-gradient(90deg,#d1d5db,#e5e7eb);
  color:#9ca3af;
  cursor:not-allowed;
}

footer {
  margin-top: 20px;
}

#preview {
  display:grid;
  grid-template-columns: repeat(auto-fill,minmax(160px,1fr));
  gap:16px;
  margin-top:18px;
}

#preview img{
  width:100%;
  height:180px;
  object-fit:cover;
  border-radius:12px;
  box-shadow: 0 14px 36px rgba(2,6,23,0.06);
  transition: transform .12s ease, box-shadow .12s ease;
}

#preview img:hover{ transform: translateY(-6px); box-shadow: 0 30px 60px rgba(2,6,23,0.10); }


/* Login container styling */
.login-container {
  width:100%;
  max-width:420px;
  background: linear-gradient(180deg, rgba(255,255,255,0.6), var(--card));
  padding:28px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(2,6,23,0.08);
  display:flex;
  align-items:stretch; /* ensure child (.login-box) can fill width without overflow */
  justify-content:center;
}

/* Form heading styling */
.login-box{
  width:100%;
}

.login-container h2 {
  margin-bottom: 16px;
  color: #0f172a;
  font-size: 20px;
  font-weight: 700;
}

/* Input group styling */
.input-group {
  margin-bottom:14px;
  text-align:left;
}

/* Label styling */
.login-container label {
  font-size:13px;
  color: var(--muted);
  margin-bottom:6px;
  display:block;
}

/* Input fields styling */
.login-container input {
  width:100%;
  padding:12px 14px;
  border-radius:10px;
  border:1px solid rgba(15,23,42,0.06);
  font-size:15px;
  color:#0f172a;
  background:linear-gradient(180deg,#ffffff,#fbfdff);
  transition: box-shadow .18s ease, border-color .18s ease;
}

/* Focus state for input fields */
.login-container input:focus{
  outline:none;
  border-color: rgba(37,99,235,0.28);
  box-shadow: 0 8px 20px rgba(37,99,235,0.06);
}

/* Button styling */
#loginBtn {
  width:100%;
  padding:12px 14px;
  border-radius:10px;
  background: linear-gradient(90deg,var(--brand),var(--brand-600));
  border:none;
  color:white;
  font-size:15px;
  font-weight:700;
}

/* Button hover state */
#loginBtn:hover{ filter:brightness(.98); }

/* Error message styling */
.error-msg{
  margin-top:10px;
  color:#ef4444;
  font-size:13px;
}

.password-wrapper{
  display:flex;
  gap:8px;
  align-items:center;
}

.password-wrapper input{ flex:1 }

#togglePassword{
  background:transparent;
  border:1px solid rgba(15,23,42,0.06);
  padding:8px 10px;
  border-radius:8px;
  cursor:pointer;
}

.login-actions{ display:flex; gap:8px; align-items:center }

/* For small devices */
@media (max-width: 900px){
  .container{ padding:18px }
  .upload-box{ flex-direction:column; align-items:stretch }
  .app-grid{ grid-template-columns: 1fr; }
  .right-panel{ order:2 }
  .left-card{ order:1 }
}

@media (max-width:520px){
  body{ padding:12px }
  .login-container{ padding:18px }
  #preview img{ height:120px }
  #preview{ grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); gap:10px }
  .app-grid{ gap:12px }
  .title-wrap .subtitle{ display:none }
}
