/* ===== Base ===== */
*{
  margin:0;
  padding:0;
  box-sizing:border-box;
}

:root{
  --blue:#0d6efd;
  --blue-dark:#0b5ed7;
  --green:#198754;
  --red:#dc3545;
  --yellow:#fff3cd;
  --bg:#f3f6fa;
  --card:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --border:#e5e7eb;
  --shadow:0 8px 24px rgba(15,23,42,.08);
}

body{
  font-family:"Yu Gothic","Meiryo",system-ui,sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.7;
}

a{
  color:inherit;
}

.container{
  max-width:1280px;
  margin:0 auto;
  padding:24px;
}

.page-header{
  background:linear-gradient(135deg,#0d6efd,#084298);
  color:white;
  padding:28px 24px;
  box-shadow:var(--shadow);
}

.page-header-inner{
  max-width:1280px;
  margin:0 auto;
}

.page-header h1{
  font-size:30px;
  margin-bottom:6px;
}

.page-header p{
  opacity:.9;
}

.section-title{
  font-size:24px;
  margin:0 0 16px;
}

.panel{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:20px;
  box-shadow:var(--shadow);
  margin-bottom:20px;
}

.top-menu{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:20px;
}

.top-menu a,
.btn,
button{
  display:inline-flex;
  justify-content:center;
  align-items:center;
  gap:6px;
  background:var(--blue);
  color:white;
  border:none;
  padding:11px 16px;
  border-radius:10px;
  text-decoration:none;
  font-weight:700;
  cursor:pointer;
  transition:.15s;
  font-size:14px;
}

.top-menu a:hover,
.btn:hover,
button:hover{
  background:var(--blue-dark);
  transform:translateY(-1px);
}

.btn-secondary{
  background:#64748b;
}

.btn-secondary:hover{
  background:#475569;
}

.btn-danger{
  background:var(--red);
}

.btn-danger:hover{
  background:#b02a37;
}

.btn-success{
  background:var(--green);
}

.btn-success:hover{
  background:#146c43;
}

.btn-block{
  width:100%;
  display:flex;
}

input,
textarea,
select{
  width:100%;
  padding:12px 13px;
  border:1px solid var(--border);
  border-radius:10px;
  background:white;
  font-size:15px;
  margin-bottom:14px;
}

textarea{
  min-height:130px;
  resize:vertical;
}

label{
  display:block;
  font-weight:700;
  margin:4px 0 6px;
}

.form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

.form-grid input{
  margin-bottom:0;
}

.form-full{
  grid-column:1/-1;
}

.help{
  color:var(--muted);
  font-size:13px;
  margin:-6px 0 12px;
}

/* ===== Buyer index ===== */
.stats{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:20px;
}

.stat-card{
  background:white;
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px 18px;
  box-shadow:var(--shadow);
  font-weight:700;
}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(330px,1fr));
  gap:20px;
}

.card{
  background:white;
  border:1px solid var(--border);
  border-radius:18px;
  overflow:hidden;
  box-shadow:var(--shadow);
  transition:.16s;
}

.card:hover{
  transform:translateY(-3px);
}

.card-image-wrap{
  position:relative;
  background:#e5e7eb;
}

.card img{
  width:100%;
  height:235px;
  object-fit:cover;
  display:block;
}

.badge{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-size:13px;
  font-weight:800;
}

.badge-open{
  background:#dcfce7;
  color:#166534;
}

.badge-closed{
  background:#fee2e2;
  color:#991b1b;
}

.badge-sold{
  background:#e0e7ff;
  color:#3730a3;
}

.card-badge{
  position:absolute;
  top:12px;
  left:12px;
}

.card-body{
  padding:16px;
}

.car-name{
  font-size:24px;
  font-weight:900;
  margin-bottom:10px;
}

.info-row{
  display:flex;
  justify-content:space-between;
  gap:14px;
  padding:8px 0;
  border-bottom:1px solid #f1f5f9;
  font-size:15px;
}

.info-row span:first-child{
  color:var(--muted);
}

.deadline{
  background:var(--yellow);
  padding:10px;
  border-radius:10px;
  margin:12px 0;
  font-weight:800;
}

/* ===== Car detail ===== */
.detail-layout{
  display:grid;
  grid-template-columns:minmax(0,2fr) minmax(320px,1fr);
  gap:20px;
  align-items:start;
}

.gallery-panel{
  background:white;
  border-radius:18px;
  padding:14px;
  box-shadow:var(--shadow);
  border:1px solid var(--border);
}

.main-image{
  width:100%;
  height:520px;
  object-fit:cover;
  border-radius:14px;
  background:#e5e7eb;
  display:block;
}

.thumb-list{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:12px;
}

.thumb-list img{
  width:112px;
  height:82px;
  object-fit:cover;
  border-radius:10px;
  border:3px solid transparent;
  cursor:pointer;
}

.thumb-list img:hover,
.thumb-list img.active{
  border-color:var(--blue);
}

.info{
  background:white;
  border-radius:18px;
  padding:20px;
  box-shadow:var(--shadow);
  border:1px solid var(--border);
}

.info h1{
  font-size:30px;
  line-height:1.3;
  margin-bottom:12px;
}

.appeal-box{
  margin-top:16px;
  padding:14px;
  background:#f8fafc;
  border-radius:12px;
  white-space:pre-wrap;
}

.bid-box{
  background:white;
  border-radius:18px;
  padding:20px;
  box-shadow:var(--shadow);
  border:1px solid var(--border);
  margin-top:20px;
}

/* ===== Tables ===== */
.table-wrap{
  width:100%;
  overflow-x:auto;
  background:white;
  border-radius:16px;
  box-shadow:var(--shadow);
  border:1px solid var(--border);
}

table{
  width:100%;
  border-collapse:collapse;
  min-width:780px;
}

th{
  background:#0f172a;
  color:white;
  padding:12px;
  text-align:left;
  white-space:nowrap;
}

td{
  padding:12px;
  border-bottom:1px solid var(--border);
  vertical-align:middle;
}

tr:hover{
  background:#f8fafc;
}

.table-img{
  width:120px;
  height:88px;
  object-fit:cover;
  border-radius:10px;
  background:#e5e7eb;
}

.actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.money{
  color:#166534;
  font-weight:900;
}

/* ===== Bids ===== */
.car-box{
  background:white;
  border-radius:18px;
  padding:20px;
  margin-bottom:20px;
  box-shadow:var(--shadow);
  border:1px solid var(--border);
}

.car-title{
  font-size:24px;
  font-weight:900;
  margin-bottom:4px;
}

.car-sub{
  color:var(--muted);
  margin-bottom:14px;
}

.highest{
  background:#ecfdf5;
}

/* ===== Image edit ===== */
.image-edit-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(170px,1fr));
  gap:12px;
  margin-bottom:18px;
}

.image-edit-item{
  position:relative;
}

.image-edit-item img{
  width:100%;
  height:130px;
  object-fit:cover;
  border-radius:12px;
  display:block;
}

.image-delete{
  position:absolute;
  top:7px;
  right:7px;
  width:32px;
  height:32px;
  border-radius:999px;
  padding:0;
  background:var(--red);
}

/* ===== Login ===== */
.login-page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.login-box{
  width:100%;
  max-width:420px;
  background:white;
  border:1px solid var(--border);
  border-radius:18px;
  padding:28px;
  box-shadow:var(--shadow);
}

/* ===== Responsive ===== */
@media(max-width:900px){
  .container{
    padding:16px;
  }

  .page-header{
    padding:22px 16px;
  }

  .detail-layout{
    grid-template-columns:1fr;
  }

  .main-image{
    height:320px;
  }

  .form-grid{
    grid-template-columns:1fr;
  }

  .grid{
    grid-template-columns:1fr;
  }

  .page-header h1{
    font-size:25px;
  }
}
