/* Makino AI Lab Share - style.css
   Phase 1 ステップ 1-3: メイン画面（ファイル一覧・ドロップ領域・ゴミ箱）
*/

:root{
  --bg: #ffffff;
  --fg: #0b0f19;
  --muted: #4b5563;
  --muted2:#6b7280;

  --line: rgba(15, 23, 42, .10);
  --line2: rgba(15, 23, 42, .14);

  --card: #ffffff;
  --soft: rgba(15, 23, 42, .04);

  --blue: #2563eb;
  --blue2:#1d4ed8;
  --blue-soft: rgba(37,99,235,.08);

  --green: #16a34a;
  --red: #dc2626;
  --red-soft: rgba(220,38,38,.08);
  --amber:#d97706;
  --amber-soft: rgba(217,119,6,.08);

  --shadow: 0 16px 50px rgba(2, 6, 23, .08);
  --shadow2: 0 10px 30px rgba(2, 6, 23, .06);

  --radius: 18px;
  --radius2: 22px;
}

/* Reset */
*{ box-sizing: border-box; }
html,body{ height: 100%; }
body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Meiryo UI, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.75;
  letter-spacing: .02em;
}
img{ max-width: 100%; height: auto; display:block; }
a{ color: inherit; text-decoration: none; }
p{ margin: 0 0 14px; }
ul{ margin: 0; padding-left: 1.2em; }
li{ margin: 6px 0; }

/* Layout */
.container{
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

/* Header */
.site-header{
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 14px;
}
.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}
.brand-mark{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display:grid;
  place-items:center;
  background: linear-gradient(145deg, var(--blue), #60a5fa);
  color: #fff;
  font-weight: 900;
  box-shadow: var(--shadow2);
}
.brand small{
  display:block;
  font-size: 12px;
  color: var(--muted2);
  font-weight: 600;
  margin-top: -2px;
}

/* Trust signal in header */
.trust-signal{
  display:flex;
  align-items:center;
  gap: 14px;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.trust-signal .lock{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(34, 197, 94, .06);
  color: #166534;
  font-weight: 700;
}
.trust-signal a{
  color: var(--blue2);
  font-weight: 700;
}
.trust-signal a:hover{
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Main */
main.container{
  padding: 32px 20px 60px;
}

/* Stack of cards */
.stack{
  display: grid;
  gap: 18px;
}

/* Card */
.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  padding: 22px;
  box-shadow: var(--shadow2);
}
.card.soft{
  background: linear-gradient(180deg, rgba(37,99,235,.06), rgba(255,255,255,1));
}
.card.narrow{
  max-width: 460px;
  margin: 24px auto;
  padding: 26px;
}
.card h2{
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: .01em;
}
.card .sub-title{
  margin: 18px 0 8px;
  font-size: 14px;
  color: var(--muted2);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.card p.lead{
  color: var(--muted);
  margin: 0 0 14px;
  font-size: 14px;
}

/* Customer header */
.customer-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--muted);
}
.customer-meta strong{ color: var(--fg); font-weight: 700; }
.customer-meta .new-badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue2);
  font-weight: 700;
  font-size: 12px;
}

/* Form */
.form-group{ margin-bottom: 14px; }
.form-group label{
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--fg);
}
.form-group input{
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--line2);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  color: var(--fg);
  transition: border-color .12s, box-shadow .12s;
}
.form-group input:focus{
  outline: none;
  border-color: rgba(37,99,235,.5);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-group input[aria-invalid="true"]{ border-color: rgba(220,38,38,.5); }
.form-actions{ margin-top: 18px; }
.form-actions .btn{ width: 100%; }

/* Alerts */
.alert{
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  margin: 0 0 14px;
  border: 1px solid transparent;
}
.alert.error{
  background: var(--red-soft);
  border-color: rgba(220,38,38,.25);
  color: #991b1b;
}
.alert.warn{
  background: var(--amber-soft);
  border-color: rgba(217,119,6,.3);
  color: #92400e;
}
.alert.info{
  background: var(--blue-soft);
  border-color: rgba(37,99,235,.25);
  color: var(--blue2);
}
.alert .meta{
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Lockout view */
.lockout{ text-align: center; padding: 14px 0; }
.lockout .icon{ font-size: 40px; line-height: 1; margin-bottom: 10px; }
.lockout h2{ margin: 0 0 8px; }
.lockout .countdown{
  font-size: 28px;
  font-weight: 800;
  color: var(--amber);
  margin: 14px 0;
  font-variant-numeric: tabular-nums;
}
.lockout .help{ font-size: 13.5px; color: var(--muted); }

/* Drop zone */
.dropzone{
  border: 2px dashed rgba(37,99,235,.45);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(37,99,235,.04), rgba(255,255,255,1));
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.dropzone:hover{ background: rgba(37,99,235,.08); }
.dropzone.dragover{
  background: rgba(37,99,235,.16);
  border-color: var(--blue2);
  border-style: solid;
}
.dropzone .icon{ font-size: 28px; line-height: 1; margin-bottom: 6px; }
.dropzone .primary-text{
  font-weight: 800;
  font-size: 15px;
  color: var(--fg);
}
.dropzone .secondary-text{
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.dropzone input[type="file"]{ display: none; }

/* Upload queue */
.upload-queue-list{
  display: grid;
  gap: 0;
}
.upload-entry{
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 6px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.upload-entry:last-child{ border-bottom: none; }
.upload-entry .upload-info{
  grid-column: 1; grid-row: 1;
  min-width: 0;
}
.upload-entry .upload-actions{
  grid-column: 2; grid-row: 1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.upload-entry .upload-bar{
  grid-column: 1 / -1; grid-row: 2;
  height: 6px;
  background: rgba(15, 23, 42, .08);
  border-radius: 3px;
  overflow: hidden;
}
.upload-entry .upload-bar-fill{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  border-radius: 3px;
  transition: width .12s linear;
}
.upload-entry.done .upload-bar-fill{
  background: linear-gradient(90deg, var(--green), #34d399);
}
.upload-entry.failed .upload-bar-fill{
  background: linear-gradient(90deg, var(--red), #f87171);
}
.upload-entry .upload-name{
  font-weight: 700;
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 6px;
}
.upload-entry .upload-meta{
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.upload-entry .upload-meta .sep{ margin: 0 6px; opacity: .55; }
.upload-entry .upload-status{ font-weight: 700; }
.upload-entry.uploading .upload-status{ color: var(--blue2); }
.upload-entry.done .upload-status{ color: var(--green); }
.upload-entry.failed .upload-status{ color: var(--red); }
.upload-entry.done .upload-name::before{ content: '✓'; color: var(--green); }
.upload-entry.failed .upload-name::before{ content: '✗'; color: var(--red); }

/* File list */
.file-list{
  display: grid;
  gap: 0;
}
.file-list .empty{
  padding: 24px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.file-row{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.file-row:last-child{ border-bottom: none; }
.file-info{ flex: 1; min-width: 0; }
.file-name{
  font-weight: 700;
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 8px;
}
.file-meta{
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.file-meta .sep{ margin: 0 6px; opacity: .55; }
.file-actions{
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Trash entry row (in main view) */
.file-row.trash-entry{
  background: rgba(217,119,6,.05);
  border-radius: 12px;
  padding: 12px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  border-bottom: none;
}
.file-row.trash-entry:hover{ background: rgba(217,119,6,.10); }
.file-row.trash-entry .file-name{ color: #92400e; }
.file-row.trash-entry .file-meta{ color: #b45309; }

/* Breadcrumb (trash view) */
.breadcrumb{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
}
.breadcrumb a{
  color: var(--blue2);
  font-weight: 700;
}
.breadcrumb a:hover{
  text-decoration: underline;
  text-underline-offset: 3px;
}
.breadcrumb .sep{ opacity: .5; }
.breadcrumb .current{
  font-weight: 700;
  color: var(--fg);
}
.breadcrumb-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Action bar */
.actions-bar{
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* Helpers */
.text-meta{
  display: block;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 14px;
}
.text-meta a{ color: var(--blue2); font-weight: 700; }
.text-meta a:hover{ text-decoration: underline; text-underline-offset: 3px; }

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--line2);
  background: #fff;
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
}
.btn:hover{
  border-color: rgba(37,99,235,.35);
  background: rgba(37,99,235,.06);
  color: var(--blue2);
}
.btn.primary{
  background: var(--blue);
  border-color: rgba(37,99,235,.65);
  color: #fff;
  box-shadow: 0 14px 40px rgba(37,99,235,.18);
}
.btn.primary:hover{ background: var(--blue2); color: #fff; }
.btn.danger{ color: var(--red); }
.btn.danger:hover{
  border-color: rgba(220,38,38,.35);
  background: rgba(220,38,38,.06);
  color: var(--red);
}
.btn.tiny{
  padding: 5px 11px;
  font-size: 12.5px;
  border-radius: 999px;
}
.btn:disabled{ opacity: .55; cursor: not-allowed; }

/* Modal */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: ma-fade .12s ease-out;
}
@keyframes ma-fade{
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal-dialog{
  background: #fff;
  border-radius: var(--radius2);
  box-shadow: 0 30px 80px rgba(2, 6, 23, .25);
  max-width: 480px;
  width: 100%;
  padding: 26px;
  animation: ma-pop .15s ease-out;
}
@keyframes ma-pop{
  from { transform: translateY(8px) scale(.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-icon{
  font-size: 32px;
  line-height: 1;
  margin-bottom: 10px;
  text-align: center;
}
.modal-title{
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 10px;
  text-align: center;
  letter-spacing: .01em;
}
.modal-body{
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 18px;
  line-height: 1.7;
  word-break: break-all;
}
.modal-body strong{ color: var(--fg); }
.modal-conflict-info{
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--soft);
  border-radius: 12px;
  font-size: 13px;
  color: var(--fg);
}
.modal-conflict-info dl{ margin: 0; display: grid; grid-template-columns: 56px 1fr; gap: 4px 8px; }
.modal-conflict-info dt{ color: var(--muted); font-weight: 700; }
.modal-conflict-info dd{ margin: 0; font-variant-numeric: tabular-nums; }
.modal-actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Toast */
.toast-container{
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 40px);
  pointer-events: none;
}
.toast{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(2, 6, 23, .18);
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: auto;
  animation: ma-toast-in .15s ease-out;
  max-width: 360px;
}
.toast .icon{ font-size: 16px; line-height: 1.2; flex-shrink: 0; }
.toast.success{ border-left: 3px solid var(--green); }
.toast.error  { border-left: 3px solid var(--red); }
.toast.info   { border-left: 3px solid var(--blue); }
.toast.success .icon{ color: var(--green); }
.toast.error   .icon{ color: var(--red); }
.toast.info    .icon{ color: var(--blue); }
.toast.fading{ opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; }
@keyframes ma-toast-in{
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Loading spinner (inline) */
.spinner{
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: ma-spin .7s linear infinite;
  vertical-align: -2px;
}
@keyframes ma-spin{
  to { transform: rotate(360deg); }
}

/* Footer */
.site-footer{
  border-top: 1px solid var(--line);
  padding: 22px 0;
  color: var(--muted2);
  font-size: 13px;
}
.footer-inner{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 720px){
  .header-inner{ flex-direction: column; align-items: flex-start; }
  .trust-signal{ justify-content: flex-start; font-size: 11.5px; }
  .trust-signal .lock{ font-size: 11px; }
  .brand small{ font-size: 11px; }
  .card.narrow{ margin: 12px auto; padding: 20px; }
}
@media (max-width: 540px){
  .file-row{ flex-direction: column; align-items: stretch; padding: 14px 4px; }
  .file-actions{ width: 100%; }
  .file-actions .btn{ flex: 1; }
  .file-row.trash-entry{ padding: 14px 12px; }
  .upload-entry{ grid-template-columns: 1fr; }
  .upload-entry .upload-actions{
    grid-column: 1; grid-row: 3;
    width: 100%;
    justify-content: stretch;
  }
  .upload-entry .upload-actions .btn{ flex: 1; }
  .modal-actions{ flex-direction: column-reverse; }
  .modal-actions .btn{ width: 100%; }
  .toast-container{ right: 10px; bottom: 10px; left: 10px; max-width: none; }
  .toast{ max-width: none; }
  .modal-dialog{ padding: 22px; }
}

/* Long filename safety */
.file-name, .upload-name{ overflow-wrap: anywhere; }
