:root {
    --primary: #f7bf50;
    --primary-hover: #e59a46;
    --secondary: #f65c5c;
    --light: #f8fafc;
    --dark: #2a1b0f;
    --gray: #64748b;
    --gray-light: #f1f5f9;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --info: #f6cf3b;
    --info-bg: #eff6ff;
    --border-radius: 12px;
    --box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --box-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #ea9e66 0%, #4b62a2 50%, #f3b974 100%);
  background-attachment: fixed;
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
  padding: 2rem;
  margin: 0;
  font-size: 15px;
}

.container {
  width: 95%;
  max-width: 1400px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  padding: 2.5rem;
  box-shadow: var(--box-shadow-lg);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition);
}

.container:hover {
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  transform: translateY(-2px);
}

h1, h2, h3 {
  color: var(--dark);
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.025em;
}

h1 {
  font-size: 3rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

h1::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 60px;
  height: 4px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 2px;
}

h2 {
  font-size: 1.5rem;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

h2::before {
  content: '';
  width: 6px;
  height: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 3px;
}

.navbar {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  padding: 1rem;
  margin-bottom: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar-brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.navbar-brand span {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.2rem;
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--primary);
  padding: 0.5rem;
}

.navbar-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.navbar-links a {
  padding: 0.75rem 1rem;
  color: var(--gray);
  text-decoration: none;
  font-weight: 600;
  border-radius: 8px;
  transition: var(--transition);
}

.navbar-links a:hover {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

@media (max-width: 768px) {
  .navbar-toggle { display: block; }
  .navbar-links { display: none; padding: 1rem 0 0 0; }
  .navbar-links.active { display: flex; }
}

@media (min-width: 1025px) {
  .cards-nav, .cards-container { display: none; }
}

@media (min-width: 769px) {
  .navbar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
  }
  
  .navbar-brand { padding: 0; }
  .navbar-links { flex-direction: row; }
  .navbar-toggle { display: none; }
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2rem 0;
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

th, td {
  padding: 1.25rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-light);
}

th {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.875rem;
}

tr:nth-child(even) { background: rgba(248, 250, 252, 0.5); }
tr:hover { background: rgba(99, 102, 241, 0.05); transform: scale(1.01); transition: var(--transition); box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }

td:first-child { font-weight: 600; color: var(--dark); }

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 1rem 1.25rem;
  margin: 0.5rem 0 1.5rem;
  border: 2px solid var(--gray-light);
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.8);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: white;
  transform: translateY(-1px);
}

input[type="submit"],
button,
.btn {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

input[type="submit"]:hover,
button:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

input[type="submit"]:active,
button:active,
.btn:active { transform: translateY(0); }

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

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

.success,
.alert,
.alert-danger {
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: var(--border-radius);
  border-left: 5px solid;
  box-shadow: var(--box-shadow);
  position: relative;
  overflow: hidden;
}

/* ---------- overlay modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: none; align-items: center; justify-content: center;
  z-index: 9999;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: #fff; padding: 2rem; border-radius: var(--border-radius);
  width: 90%; max-width: 420px; box-shadow: var(--box-shadow-lg);
}
.modal-title { margin-top: 0; color: var(--accent); }
.modal-actions { margin-top: 1.5rem; text-align: right; }
.modal-actions button { margin-left: .5rem; }

.success {
  background: linear-gradient(135deg, var(--success-bg) 0%, rgba(16, 185, 129, 0.1) 100%);
  border-color: var(--success);
  color: #065f46;
}

.alert,
.alert-danger {
  background: linear-gradient(135deg, var(--danger-bg) 0%, rgba(239, 68, 68, 0.1) 100%);
  border-color: var(--danger);
  color: #991b1b;
}

.notification {
  background: linear-gradient(135deg, var(--info-bg) 0%, rgba(59, 130, 246, 0.1) 100%);
  border-color: var(--info);
  color: #1e40af;
}

.terminated {
  background: linear-gradient(135deg, var(--warning-bg) 0%, rgba(245, 158, 11, 0.1) 100%);
  border-color: var(--warning);
  color: #92400e;
}

.negative-balance {
  color: var(--danger);
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 6px;
}

.positive-balance {
  color: var(--success);
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 6px;
}

.status-vacant,
.status-pending,
.status-rented {
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-vacant  { color: var(--gray);   background: rgba(100, 116, 139, 0.1); }
.status-pending { color: var(--warning); background: rgba(245, 158, 11, 0.1); }
.status-rented  { color: var(--success); background: rgba(16, 185, 129, 0.1); }

.error {
  color: var(--danger);
  background: var(--danger-bg);
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  margin: 1rem 0;
}

.disabled-delete {
  color: var(--gray);
  cursor: not-allowed;
  opacity: 0.5;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  background: rgba(100, 116, 139, 0.1);
  border-radius: 4px;
  font-size: 0.875rem;
}

.cards-container {
  display: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  margin: 2rem 0;
  padding-bottom: 1rem;
  gap: 1rem;
}

.cards-wrapper {
  display: flex;
  gap: 1rem;
  padding-bottom: 1rem;
}

.card {
  scroll-snap-align: start;
  flex: 0 0 calc(100% - 2rem);
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 1.5rem;
  transition: var(--transition);
  border: 1px solid var(--gray-light);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--box-shadow-lg);
}

.card-header {
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-light);
}

.card-row {
  display: flex;
  margin-bottom: 0.75rem;
}

.card-label {
  font-weight: 600;
  color: var(--gray);
  min-width: 120px;
}

.card-value { flex: 1; }

.cards-nav {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 1024px) {
  .cards-container { display: block; }
  table:not(.cards-container table) { display: none !important; }
}

@media (max-width: 768px) {
  .card { flex: 0 0 calc(100% - 1rem); }
}

@media (max-width: 480px) {
  body { padding: 0.5rem; }
  .container { width: 100%; padding: 1.5rem; border-radius: 16px; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.25rem; }
  th, td { padding: 0.75rem 1rem; font-size: 0.875rem; }
}

html { scroll-behavior: smooth; }

.navbar-brand img { width: 40%; height: auto; }

.btn-view {
  padding: 0.5rem 1rem;
  background-color: #5c636a;
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-block;
  text-decoration: none;
  margin-right: 0.5rem;
}

.btn-view:hover {
  background-color: #495057;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-buttons { display: flex; gap: 0.5rem; align-items: center; }

.dots-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 1rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ccc;
  cursor: pointer;
  transition: background-color 0.3s;
}

.dot.active { background-color: #6366f1; }

.cards-prev,
.cards-next {
  background: #6366f1 !important;
  color: white !important;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  box-shadow: 0 2px 5px rgba(99, 102, 241, 0.3);
  transition: all 0.3s;
}

.cards-prev:hover,
.cards-next:hover {
  background: #4f46e5 !important;
  transform: scale(1.1);
}

.cards-prev:disabled,
.cards-next:disabled {
  background: #c7d2fe !important;
  cursor: not-allowed;
  transform: none;
}

.cards-outer { position: relative; }

.cards-prev {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.cards-next {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

@media (min-width: 1025px) { .dots-container { display: none; } }

@media (max-width: 1024px) {
  .properties-table { display: none; }
  .properties-slideshow {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    padding: 15px 0;
    -webkit-overflow-scrolling: touch;
  }
  .property-card {
    display: inline-block;
    width: 85%;
    max-width: 350px;
    margin-right: 15px;
    white-space: normal;
    vertical-align: top;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 15px;
  }
  .property-card:last-child { margin-right: 0; }
  .property-card h3 { margin-top: 0; color: #333; }
  .property-card p { margin: 8px 0; }
  .property-card .card-field {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
  }
  .property-card .card-field label {
    font-weight: bold;
    margin-right: 10px;
  }
  .property-card .card-actions {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .property-card input[type="text"],
  .property-card input[type="number"] {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
  }
  .property-card .btn {
    padding: 8px 12px;
    font-size: 14px;
  }
  .property-card .status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
  }
  .status-vacant   { background-color: #d4edda; color: #155724; }
  .status-occupied { background-color: #f8d7da; color: #721c24; }
  .status-maintenance { background-color: #fff3cd; color: #856404; }
}

@media (min-width: 1025px) { .properties-slideshow { display: none; } }

.disabled-btn {
  display: inline-block;
  padding: 8px 12px;
  background-color: #cccccc;
  color: #666666;
  border-radius: 4px;
  cursor: not-allowed;
  font-size: 14px;
}

@media (max-width: 1024px) {
  .users-table { display: none; }
  .cards-container { display: block; }
}