/* ============================================================
   Landcraft Realty Solutions — Sheet Admin Styles
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0a2e1a;
  --primary-light: #13522e;
  --accent: #c9a84c;
  --accent-light: #dfc06a;
  --accent-dark: #a8892e;
  --bg: #f5f2eb;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e1d8;
  --error: #dc2626;
  --error-bg: rgba(220, 38, 38, 0.08);
  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.1);
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 2rem 1rem;
}

/* --- Container --- */
.admin-container {
  max-width: 740px;
  margin: 0 auto;
}

/* --- Header --- */
.admin-header {
  text-align: center;
  margin-bottom: 2rem;
}

.admin-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.admin-logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.admin-logo-accent {
  color: var(--accent-dark);
}

.admin-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

.admin-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- Form Card --- */
.admin-form {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

/* --- Status Message --- */
.form-status {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  text-align: center;
  transition: opacity 0.3s ease;
}

.form-status--success {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.form-status--error {
  background-color: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

/* --- Form Groups --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #a0a0a0;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* --- Form Actions (Submit + Cancel) --- */
.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.form-actions .btn-submit {
  flex: 1;
}

/* --- Submit Button --- */
.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-submit:hover {
  background: var(--accent-light);
  box-shadow: 0 4px 12px rgba(201, 168, 76, 0.3);
}

.btn-submit:active {
  transform: scale(0.98);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Edit mode: distinguish the Update button */
.btn-submit--edit {
  background: var(--primary);
  color: #fff;
}
.btn-submit--edit:hover {
  background: var(--primary-light);
  box-shadow: 0 4px 12px rgba(10, 46, 26, 0.3);
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Cancel Button --- */
.btn-cancel {
  padding: 0.85rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.btn-cancel:hover {
  background: var(--border);
  color: var(--text);
  border-color: #ccc;
}

/* --- Refresh Bar --- */
.refresh-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-refresh:hover {
  background: var(--accent);
  color: var(--primary);
  border-color: var(--accent);
}

.refresh-info {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- Table Section --- */
.table-section {
  margin-top: 0.5rem;
}

.table-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.table-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--primary);
}

.table-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2.5rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* --- Projects Table --- */
.projects-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.projects-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.projects-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.4;
}

.projects-table tr:last-child td {
  border-bottom: none;
}

.projects-table tr:hover td {
  background: rgba(201, 168, 76, 0.04);
}

.projects-table .col-category {
  white-space: nowrap;
  width: 1%;
}

.projects-table .col-name {
  font-weight: 500;
  min-width: 140px;
}

.projects-table .col-desc {
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projects-table .col-image {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.projects-table .col-actions {
  width: 1%;
  white-space: nowrap;
}

/* --- Category Badge in Table --- */
.cat-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.cat-badge--architect {
  color: #0a2e1a;
  background: rgba(10, 46, 26, 0.1);
}

.cat-badge--interiors {
  color: #a8892e;
  background: rgba(201, 168, 76, 0.15);
}

.cat-badge--constructions {
  color: #6b21a8;
  background: rgba(107, 33, 168, 0.1);
}

/* --- Action Buttons --- */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.action-btn + .action-btn {
  margin-left: 4px;
}

.action-btn--edit {
  color: var(--accent-dark);
}
.action-btn--edit:hover {
  background: rgba(201, 168, 76, 0.12);
  border-color: var(--accent);
}

.action-btn--delete {
  color: var(--error);
}
.action-btn--delete:hover {
  background: var(--error-bg);
  border-color: var(--error);
}

/* --- Table Empty State --- */
.table-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- Footer --- */
.admin-footer {
  margin-top: 2.5rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.admin-footer code {
  background: rgba(10, 46, 26, 0.06);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.78rem;
}

.admin-footer a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.admin-footer a:hover {
  color: var(--primary);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  body {
    padding: 1rem 0.75rem;
  }

  .admin-container {
    max-width: 100%;
  }

  .admin-form {
    padding: 1.25rem;
  }

  .admin-logo {
    font-size: 1.25rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn-cancel {
    width: 100%;
    text-align: center;
  }

  .projects-table .col-image,
  .projects-table .col-desc {
    display: none;
  }
}
