/* ============================================================
   style.css — M-UPLINK
   Consistent with ECOSYSTE-M visual system.
   ============================================================ */

:root {
  --color-bg-black:    #050a14;
  --color-bg:          #0a1628;
  --color-panel:       #0e1f38;
  --color-panel-light: #142b4d;
  --color-border:      #1f4068;
  --color-cyan:        #4fd6ff;
  --color-cyan-soft:   #8be9ff;
  --color-accent-blue: #2b6cff;
  --color-text-bright: #e7f2ff;
  --color-text-muted:  #93b3da;
  --color-success:     #3ddc97;
  --color-error:       #ff5a6a;
  --color-warning:     #ffb347;
  --font-display: 'Orbitron', sans-serif;
  --font-body:    'Rajdhani', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 18px; }

body {
  background: var(--color-bg-black);
  color: var(--color-text-bright);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── Background grid ── */
.background-grid {
  position: fixed; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(79,214,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,214,255,0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  background-color: var(--color-bg-black);
}
.background-grid::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at top,    rgba(43,108,255,0.18), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(79,214,255,0.10), transparent 60%);
}

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(14,31,56,0.9), rgba(10,22,40,0.6));
  backdrop-filter: blur(4px);
}
.header-inner {
  max-width: 680px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo-slot {
  width: 42px; height: 42px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--color-border); border-radius: 6px;
  background: var(--color-panel);
}
.logo-img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
h1 {
  font-family: var(--font-display);
  font-size: clamp(15px, 4vw, 19px);
  letter-spacing: 1.2px; color: var(--color-text-bright); line-height: 1.3;
}
h1 span { color: var(--color-cyan); }
.subtitle {
  color: var(--color-text-muted); font-size: clamp(11px, 2.6vw, 13px);
  letter-spacing: 0.6px; margin-top: 2px; text-transform: uppercase;
}
.back-link {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  font-family: var(--font-body); font-weight: 600; font-size: 0.85rem;
  color: var(--color-cyan-soft); text-decoration: none; padding: 9px 16px;
  border: 1.5px solid var(--color-border); border-radius: 4px;
  background: var(--color-panel); transition: all 0.18s; white-space: nowrap;
}
.back-link:hover { color: var(--color-cyan); border-color: var(--color-cyan); background: rgba(79,214,255,0.08); }

/* ── Main ── */
.main-container {
  max-width: 680px; margin: 0 auto; padding: 28px 18px 70px;
  display: flex; flex-direction: column; gap: 18px;
}

/* ── Panel ── */
.panel {
  background: linear-gradient(160deg, var(--color-panel), var(--color-bg));
  border: 1px solid var(--color-border); border-radius: 4px; padding: 30px 26px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  box-shadow: 0 0 0 1px rgba(79,214,255,0.05), 0 20px 50px rgba(0,0,0,0.45);
}
.hidden { display: none !important; }

.panel-title {
  font-family: var(--font-display); font-size: clamp(15px, 3.5vw, 19px);
  letter-spacing: 0.5px; margin-bottom: 22px; color: var(--color-text-bright);
}
.help-text { color: var(--color-text-muted); font-size: 0.92rem; line-height: 1.6; }

/* ── Loading ── */
.loading-wrap {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 20px; gap: 20px;
}
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 12px rgba(79,214,255,0.3);
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: var(--font-display); font-size: 0.72rem;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--color-text-muted);
  animation: pulse-txt 1.4s ease-in-out infinite;
}
@keyframes pulse-txt { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* Progress bar */
.progress-bar-track {
  width: 100%; max-width: 320px; height: 4px;
  background: var(--color-border); border-radius: 4px; overflow: hidden;
  margin-top: 4px;
}
.progress-bar-fill {
  height: 100%; width: 0; background: var(--color-cyan);
  border-radius: 4px; transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(79,214,255,0.6);
}

/* ── Error screen ── */
.error-wrap {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 30px 20px; gap: 10px;
}
.error-icon { font-size: 2.4rem; }
.error-msg  { color: var(--color-text-muted); font-size: 0.95rem; line-height: 1.6; }

/* ── Success screen ── */
.success-wrap {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 10px 0;
}
.success-icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  background: rgba(61,220,151,0.12);
  border: 2px solid var(--color-success);
  color: var(--color-success);
  box-shadow: 0 0 24px rgba(61,220,151,0.25);
  margin-bottom: 18px;
}
.confirm-card {
  width: 100%; background: var(--color-panel-light);
  border: 1px solid var(--color-border); border-radius: 4px;
  padding: 16px 20px; margin-top: 18px; text-align: left;
  display: flex; flex-direction: column; gap: 10px;
}
.confirm-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; font-size: 0.9rem; flex-wrap: wrap;
}
.confirm-row span:first-child { color: var(--color-text-muted); flex-shrink: 0; }
.confirm-row span:last-child  { color: var(--color-text-bright); font-weight: 600; text-align: right; }
.confirm-row--files { flex-direction: column; align-items: flex-start; }
.confirm-row--files span:first-child { margin-bottom: 6px; }
.confirm-file-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.confirm-file-list li {
  font-size: 0.85rem; color: var(--color-cyan-soft);
  padding-left: 14px; position: relative;
}
.confirm-file-list li::before { content: '→'; position: absolute; left: 0; color: var(--color-border); }

/* ── Field ── */
.field { margin-bottom: 20px; }
.field-label {
  display: block; font-family: var(--font-display);
  font-size: 0.72rem; letter-spacing: 1px; text-transform: uppercase;
  color: var(--color-cyan-soft); margin-bottom: 8px;
}
select {
  width: 100%; appearance: none; -webkit-appearance: none;
  background-color: var(--color-panel-light);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234fd6ff' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
  border: 1.5px solid var(--color-border); color: var(--color-text-bright);
  font-family: var(--font-body); font-weight: 600; font-size: 1rem;
  padding: 12px 40px 12px 14px; border-radius: 4px; cursor: pointer;
  transition: border-color 0.18s;
}
select:focus { outline: none; border-color: var(--color-cyan); box-shadow: 0 0 0 3px rgba(79,214,255,0.18); }
select:disabled { opacity: 0.45; cursor: not-allowed; }
select option { background: var(--color-panel); color: var(--color-text-bright); }

/* ── Deadline badge ── */
.deadline-badge {
  display: inline-block; font-family: var(--font-display);
  font-size: 0.72rem; letter-spacing: 0.8px;
  color: var(--color-warning);
  background: rgba(255,179,71,0.08);
  border: 1px solid rgba(255,179,71,0.35);
  padding: 6px 14px; border-radius: 20px; margin-bottom: 20px;
}

/* ── Closed group notice ── */
.notice-closed {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(255,90,106,0.07);
  border: 1px solid rgba(255,90,106,0.25);
  border-radius: 4px; padding: 12px 16px; margin-bottom: 18px;
  font-size: 0.88rem; color: var(--color-text-muted); line-height: 1.5;
}

/* ── Files section ── */
.files-blocked-msg {
  color: var(--color-text-muted); font-size: 0.88rem; margin-bottom: 12px;
}
.file-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.file-counter {
  font-family: var(--font-display); font-size: 0.72rem;
  letter-spacing: 1px; color: var(--color-text-muted);
}

/* ── Buttons ── */
.btn-action {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--color-accent-blue); color: #fff;
  font-family: var(--font-body); font-weight: 700; font-size: 0.92rem;
  padding: 11px 18px; border-radius: 4px; border: none; cursor: pointer;
  transition: background 0.18s, box-shadow 0.18s; white-space: nowrap;
  min-height: 44px;
}
.btn-action:hover { background: #1d54d6; box-shadow: 0 0 14px rgba(43,108,255,0.45); }
.btn-action--secondary { background: var(--color-panel-light); border: 1.5px solid var(--color-border); color: var(--color-text-muted); }
.btn-action--secondary:hover { border-color: var(--color-cyan); color: var(--color-cyan); background: rgba(79,214,255,0.06); box-shadow: none; }

.btn-primary {
  width: 100%; padding: 16px;
  font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 1px;
  color: var(--color-bg-black);
  background: linear-gradient(135deg, var(--color-cyan), var(--color-cyan-soft));
  border: none; border-radius: 4px; cursor: pointer; text-transform: uppercase;
  transition: all 0.2s;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 0 22px rgba(79,214,255,0.5); transform: translateY(-1px); }
.btn-primary:disabled { background: var(--color-border); color: var(--color-text-muted); cursor: not-allowed; }
.btn-submit { margin-top: 8px; }

/* ── File list ── */
.file-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--color-panel-light); border: 1px solid var(--color-border);
  border-radius: 4px; padding: 10px 14px; font-size: 0.88rem;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.file-item-icon { flex-shrink: 0; font-size: 1.1rem; }
.file-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-bright); }
.file-item-size { flex-shrink: 0; color: var(--color-text-muted); font-size: 0.8rem; }
.file-item-remove {
  flex-shrink: 0; background: transparent; border: none;
  color: var(--color-text-muted); font-size: 1rem; cursor: pointer;
  padding: 4px 6px; border-radius: 3px; line-height: 1;
  transition: color 0.15s;
}
.file-item-remove:hover { color: var(--color-error); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-panel-light); border: 1px solid var(--color-cyan);
  color: var(--color-cyan); font-family: var(--font-body);
  font-weight: 700; font-size: 0.95rem; padding: 12px 24px;
  border-radius: 4px; opacity: 0; transition: opacity 0.2s, transform 0.2s;
  pointer-events: none; z-index: 999; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Footer ── */
.site-footer {
  text-align: center; color: var(--color-text-muted);
  font-size: 0.78rem; padding: 24px; letter-spacing: 0.5px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  html { font-size: 17px; }
  .header-inner { padding: 12px 16px; }
  .main-container { padding: 16px 12px 60px; gap: 14px; }
  .panel { padding: 22px 16px; }
  .back-link { font-size: 0.78rem; padding: 8px 10px; }
  .file-row { gap: 8px; }
  .btn-action { font-size: 0.85rem; padding: 10px 14px; }
}
@media (max-width: 420px) {
  .file-row { flex-direction: column; align-items: flex-start; }
  .btn-action { width: 100%; justify-content: center; }
  .file-counter { align-self: flex-end; }
}
