/**
 * CondoFlow - Estilos Principales
 * Diseño profesional con Navy (#0f172a) + Emerald Green (#10b981)
 */

/* Reset y variables */
:root {
  --navy: #0f172a;
  --navy-light: #1e293b;
  --navy-lighter: #334155;
  --emerald: #10b981;
  --emerald-light: #34d399;
  --emerald-dark: #059669;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --red: #ef4444;
  --red-light: #fca5a5;
  --orange: #f59e0b;
  --blue: #3b82f6;
  --yellow: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --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.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--gray-900);
  background-color: var(--gray-50);
  line-height: 1.6;
}

/* Tipografía */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy);
}

h1 {
  font-size: 2.25rem;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.875rem;
  margin-bottom: 0.5rem;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

h4 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

h5 {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

h6 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

a {
  color: var(--emerald);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--emerald-dark);
}

/* Layout Login */
.login-container {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-lighter) 100%);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 60%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0.3;
}

.login-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--navy) 0%, transparent 100%);
}

.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.login-logo-icon {
  width: 60px;
  height: 60px;
  background: var(--white);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.login-logo h1 {
  color: var(--white);
  font-size: 3rem;
  margin: 0;
}

.login-subtitle {
  color: var(--gray-300);
  font-size: 1.25rem;
  text-align: center;
  max-width: 400px;
}

.login-right {
  width: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: var(--white);
}

.login-card {
  width: 100%;
  max-width: 450px;
}

.login-card h2 {
  margin-bottom: 0.5rem;
}

.login-card p {
  color: var(--gray-600);
  margin-bottom: 2rem;
}

/* Layout Admin (Sidebar) */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background: var(--gray-50);
}

.sidebar {
  width: 260px;
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 1000;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--navy-lighter);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--white);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.sidebar-logo-text h3 {
  color: var(--white);
  font-size: 1.25rem;
  margin: 0;
}

.sidebar-logo-text p {
  color: var(--gray-400);
  font-size: 0.75rem;
  margin: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 0;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  color: var(--gray-300);
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--navy-light);
  color: var(--white);
  border-left-color: var(--emerald);
}

.sidebar-nav a.active {
  background: var(--navy-light);
  color: var(--white);
  border-left-color: var(--emerald);
}

.sidebar-nav svg {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--navy-lighter);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  background: var(--emerald);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--white);
}

.sidebar-user-info h4 {
  color: var(--white);
  font-size: 0.875rem;
  margin: 0;
}

.sidebar-user-info p {
  color: var(--gray-400);
  font-size: 0.75rem;
  margin: 0;
}

.btn-logout {
  width: 100%;
  padding: 0.75rem;
  background: transparent;
  border: 1px solid var(--navy-lighter);
  color: var(--gray-300);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.btn-logout:hover {
  background: var(--navy-light);
  color: var(--white);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 2rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--gray-600);
}

.page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

/* Layout Tenant (Navbar Top) */
.tenant-layout {
  min-height: 100vh;
  background: var(--gray-50);
}

.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: var(--shadow);
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--navy);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.25rem;
}

.navbar-logo h3 {
  color: var(--navy);
  font-size: 1.25rem;
  margin: 0;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar-welcome {
  text-align: right;
}

.navbar-welcome p {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin: 0;
}

.navbar-welcome h4 {
  font-size: 1rem;
  margin: 0;
}

.tenant-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-title svg {
  color: var(--emerald);
}

.card-title h3 {
  margin: 0;
}

.card-body {
  /* Contenido del card */
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.blue {
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue);
}

.stat-icon.green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald);
}

.stat-icon.orange {
  background: rgba(245, 158, 11, 0.1);
  color: var(--orange);
}

.stat-icon.red {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}

.stat-icon.yellow {
  background: rgba(251, 191, 36, 0.1);
  color: var(--yellow);
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

/* Summary Card (Tenant) */
.summary-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-lighter) 100%);
  border-radius: var(--radius);
  padding: 2rem;
  color: var(--white);
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

.summary-card h2 {
  color: var(--white);
  margin-bottom: 0.5rem;
}

.summary-card p {
  color: var(--gray-300);
  margin-bottom: 2rem;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.summary-stat h3 {
  color: var(--gray-400);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.summary-stat p {
  color: var(--white);
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

/* Tables */
.table-container {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--gray-50);
}

thead th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--gray-200);
}

tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: var(--transition);
}

tbody tr:hover {
  background: var(--gray-50);
}

tbody td {
  padding: 1rem;
  color: var(--gray-900);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-admin {
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue);
}

.badge-inquilino {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald);
}

.badge-completed {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald);
}

.badge-pending {
  background: rgba(245, 158, 11, 0.1);
  color: var(--orange);
}

.badge-failed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}

.badge-active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald);
}

.badge-inactive {
  background: rgba(107, 114, 128, 0.1);
  color: var(--gray-600);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--emerald);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--emerald-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--navy);
  color: var(--white);
}

.btn-secondary:hover {
  background: var(--navy-lighter);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

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

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

.btn-icon {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--white);
}

.form-control:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-control:disabled {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
}

select.form-control {
  cursor: pointer;
}

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

.form-help {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.form-error {
  font-size: 0.75rem;
  color: var(--red);
  margin-top: 0.25rem;
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald-dark);
  border-left: 4px solid var(--emerald);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-left: 4px solid var(--red);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border-left: 4px solid var(--orange);
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border-left: 4px solid var(--blue);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  color: var(--gray-300);
}

.empty-state h3 {
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--gray-500);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-500);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  background: var(--white);
}

.checkbox-group:hover {
  background: var(--gray-50);
  border-color: var(--emerald);
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--emerald);
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-success {
  color: var(--emerald);
}

.text-danger {
  color: var(--red);
}

.text-warning {
  color: var(--orange);
}

.text-muted {
  color: var(--gray-500);
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.d-flex {
  display: flex;
}

.justify-between {
  justify-content: space-between;
}

.align-center {
  align-items: center;
}

.gap-1 {
  gap: 0.5rem;
}

.gap-2 {
  gap: 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }

  .main-content {
    margin-left: 220px;
  }
}

@media (max-width: 768px) {
  .login-container {
    flex-direction: column;
  }

  .login-left {
    padding: 2rem 1.5rem;
  }

  .login-right {
    width: 100%;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .navbar {
    padding: 1rem;
  }

  .tenant-content {
    padding: 1rem;
  }

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

  .summary-stats {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  table {
    font-size: 0.875rem;
  }

  thead th,
  tbody td {
    padding: 0.75rem 0.5rem;
  }
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--emerald);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}