/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

/* Navbar */
.navbar {
  background: #2c3e50;
  color: #fff;
  padding: 0 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.navbar-brand {
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: bold;
}
.navbar-links a {
  color: #bdc3c7;
  text-decoration: none;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  transition: color 0.2s;
}
.navbar-links a:hover,
.navbar-links a.active {
  color: #fff;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 2px solid #ddd;
}
.tab-btn {
  padding: 0.6rem 1.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.95rem;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tab-btn:hover { color: #333; }
.tab-btn.active {
  color: #2c3e50;
  border-bottom-color: #2c3e50;
  font-weight: bold;
}

/* Tables */
.card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
table.dataTable { width: 100% !important; }
table.dataTable thead th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}
table.dataTable tbody td {
  font-size: 0.9rem;
  vertical-align: middle;
}

/* Clickable cells */
.cell-link {
  cursor: pointer;
  color: #2980b9;
  text-align: center;
  font-weight: bold;
}
.cell-link:hover {
  background: #eaf2f8;
}
.cell-maru {
  text-align: center;
}
.cell-dash {
  text-align: center;
  color: #ccc;
}

/* Popup / Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  min-width: 320px;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-box h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: #2c3e50;
}
.modal-box .close-btn {
  float: right;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #999;
}
.modal-box .close-btn:hover { color: #333; }
.modal-box ul {
  list-style: none;
  padding: 0;
}
.modal-box ul li {
  padding: 0.4rem 0;
}
.modal-box ul li a {
  color: #2980b9;
  text-decoration: none;
}
.modal-box ul li a:hover {
  text-decoration: underline;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
}
.form-group input:focus,
.form-group select:focus {
  border-color: #2980b9;
  outline: none;
  box-shadow: 0 0 0 2px rgba(41,128,185,0.15);
}

.btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-primary { background: #2c3e50; color: #fff; }
.btn-primary:hover { background: #34495e; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

/* Property detail */
.property-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.property-info dt {
  font-weight: 600;
  color: #666;
  font-size: 0.85rem;
}
.property-info dd {
  margin-bottom: 0.7rem;
  margin-left: 0;
}
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.file-item {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0.75rem;
  text-align: center;
  background: #fafafa;
  position: relative;
}
.file-item img {
  max-width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 3px;
}
.file-item .file-name {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  word-break: break-all;
}
.file-item .delete-file-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
  cursor: pointer;
  display: none;
}
.admin-mode .file-item .delete-file-btn { display: block; }

/* Admin */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
}
.ad-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.ad-row label {
  min-width: 80px;
  font-weight: normal;
}
.ad-row input[type="url"] {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Login page */
.login-card {
  max-width: 400px;
  margin: 3rem auto;
}

/* Flash messages */
.flash {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Confirm date popup */
.confirm-date-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}
.confirm-date-form input[type="date"] {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Responsive */
@media (max-width: 768px) {
  .navbar-inner { flex-direction: column; height: auto; padding: 0.5rem 0; }
  .navbar-links { margin-top: 0.5rem; }
  .property-header { flex-direction: column; }
}
