/* Custom Styles for Rent Management System - Inspired by Perspective.co */

/* Global Styles with Modern Color Palette */
:root {
  --primary-color: #4f46e5;
  --primary-light: #6366f1;
  --primary-dark: #3730a3;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #3b82f6;
  --light-color: #f8fafc;
  --dark-color: #1e293b;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-soft: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  --gradient-purple: linear-gradient(135deg, #d299c2 0%, #fef9d3 100%);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.7;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  background-attachment: fixed;
  font-weight: 400;
  color: var(--dark-color);
  padding-top: 0 !important;
  margin-top: 0 !important;
}

/* Navigation Styles */
.navbar {
  backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 9999 !important;
  width: 100%;
  margin: 0 !important;
}

/* Ensure navbar container and all children are visible */
nav, nav * {
  visibility: visible !important;
  opacity: 1 !important;
}

.navbar-collapse {
  z-index: 10000 !important;
}

.navbar .dropdown-menu {
  z-index: 10001 !important;
}

/* Ensure navbar never goes above modals */
.modal-open .navbar {
  z-index: 1030 !important;
}

/* Ensure navbar is always visible */
nav.navbar {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
}

.brand-icon {
  background: var(--gradient-primary);
}

.navbar-nav .nav-link {
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: 8px;
  transition: all 0.3s ease;
  color: var(--dark-color) !important;
}

.navbar-nav .nav-link:hover {
  background-color: var(--light-color);
  transform: translateY(-1px);
  color: var(--primary-color) !important;
}

.user-avatar {
  font-weight: 600;
  background: var(--gradient-primary);
}

.dropdown-menu {
  border-radius: 12px;
  border: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  z-index: 1050;
}

/* Ensure all dashboard content stays below dropdowns and modals */
.dashboard-container .row,
.dashboard-container .col-12,
.dashboard-container .col-md-8,
.dashboard-container .col-md-4,
.dashboard-container .col-lg-6,
.dashboard-container .col-lg-4,
.dashboard-container .card,
.dashboard-container .card-header,
.dashboard-container .card-body {
  position: relative;
  z-index: 1;
}

/* Quick actions and buttons */
.dashboard-container .btn,
.dashboard-container .quick-actions {
  position: relative;
  z-index: 1;
}

/* Override any Bootstrap z-index that might interfere */
.bg-primary {
  position: relative;
  z-index: 1;
}

/* Dashboard welcome section specific styling */
.dashboard-welcome {
  position: relative;
  z-index: 1;
}

.dashboard-welcome .welcome-card {
  position: relative;
  z-index: 1;
}

/* Modal z-index - use Bootstrap defaults with minor adjustments */
.modal {
  z-index: 1055;
}

.modal-backdrop {
  z-index: 1050;
}

/* Fix for Bootstrap dropdown positioning issues */
.dropdown-toggle::after {
  vertical-align: 0.125em;
}

/* Hero Section with Modern Design */
.hero-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%), 
              radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.2) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(168, 237, 234, 0.3) 0%, transparent 50%),
              radial-gradient(circle at 40% 80%, rgba(254, 214, 227, 0.2) 0%, transparent 50%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KPGcgZmlsbD0iIzAwMCIgZmlsbC1vcGFjaXR5PSIwLjAzIj4KPGNpcmNsZSBjeD0iNyIgY3k9IjciIHI9IjEiLz4KPC9nPgo8L2c+Cjwvc3ZnPg==');
  opacity: 0.1;
  z-index: 1;
}

.hero-section > * {
  position: relative;
  z-index: 2;
}

.min-vh-75 {
  min-height: 85vh;
}

.hero-content h1 {
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background: linear-gradient(135deg, var(--dark-color) 0%, var(--primary-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-content .lead {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--secondary-color);
  line-height: 1.8;
}

.feature-icons .feature-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(20px);
  transition: all 0.3s ease;
}

.feature-icons .feature-icon:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

/* Feature Cards */
.feature-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #e9ecef !important;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.feature-card .feature-icon {
  margin-bottom: 1rem;
}

/* Statistics Section */
.stats-section .stat-item h2 {
  margin-bottom: 0.5rem;
}

/* Auth Pages */
.auth-container {
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.auth-container .card {
  border-radius: 1rem;
  overflow: hidden;
}

.auth-container .card-header {
  border-bottom: none;
}

.form-floating > .form-control {
  border-radius: 0.5rem;
  border: 2px solid #e9ecef;
  transition: border-color 0.3s ease;
}

.form-floating > .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: none;
}

.form-floating > label {
  color: #6c757d;
}

/* Dashboard Styles */
.dashboard-container {
  background-color: #f8f9fa;
  min-height: calc(100vh - 80px);
  position: relative;
  z-index: 1;
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.dashboard-main {
  position: relative;
  z-index: 1;
  margin-top: 0 !important;
  padding-top: 1rem;
}

.main-content {
  position: relative;
  z-index: 1;
}

.welcome-card {
  background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
  position: relative;
  z-index: 1;
}

.stat-card {
  border: 1px solid #e9ecef;
  transition: transform 0.2s ease;
  position: relative;
  z-index: 1;
}

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

.stat-icon {
  min-width: 60px;
  min-height: 60px;
}

/* Activity List */
.activity-list .activity-item:last-child {
  border-bottom: none !important;
}

.activity-icon {
  min-width: 40px;
  min-height: 40px;
}

.activity-title {
  font-weight: 600;
  color: #212529;
}

.activity-desc {
  font-size: 0.875rem;
}

.activity-time {
  font-size: 0.75rem;
}

/* Notifications */
.notification-item:last-child {
  border-bottom: none !important;
}

.notification-text {
  font-size: 0.875rem;
  line-height: 1.4;
}

.extra-small {
  font-size: 0.7rem;
}

/* Error Pages */
.error-container {
  min-height: 70vh;
  display: flex;
  align-items: center;
}

.error-icon {
  opacity: 0.7;
}

.error-debug {
  max-height: 300px;
  overflow-y: auto;
}

.error-debug pre {
  font-size: 0.8rem;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Buttons */
.btn {
  border-radius: 0.5rem;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  transition: all 0.3s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-lg {
  padding: 0.875rem 1.5rem;
  font-size: 1.125rem;
}

/* Cards */
.card {
  border-radius: 0.75rem;
  border: 1px solid #e9ecef;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  position: relative;
  z-index: 1;
}

.card-header {
  background-color: #fff;
  border-bottom: 1px solid #e9ecef;
  font-weight: 600;
}

/* Glass card styling with proper z-index */
.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
}

/* Ensure maintenance content doesn't overlap dropdowns */
.maintenance-content {
  position: relative;
  z-index: 1;
}

/* Maintenance page specific styling */
.maintenance-page {
  position: relative;
  z-index: 1;
}

.maintenance-page .card,
.maintenance-page .glass-card {
  position: relative;
  z-index: 1;
}

/* Tenant portal pages - comprehensive z-index management */
.tenant-page,
.maintenance-page {
  position: relative;
  z-index: 1;
}

.tenant-page .container-fluid,
.tenant-page .row,
.tenant-page .col-12,
.tenant-page .col-md-4,
.tenant-page .col-lg-8,
.tenant-page .col-lg-4,
.tenant-page .card,
.tenant-page .glass-card,
.tenant-page .card-header,
.tenant-page .card-body {
  position: relative;
  z-index: 1;
}

/* Ensure all tenant portal content stays below modals */
.maintenance-page .container-fluid,
.maintenance-page .row,
.maintenance-page .col-12,
.maintenance-page .col-md-4,
.maintenance-page .col-lg-8,
.maintenance-page .col-lg-4,
.maintenance-page .card,
.maintenance-page .glass-card,
.maintenance-page .card-header,
.maintenance-page .card-body,
.maintenance-page .table-responsive {
  position: relative;
  z-index: 1;
}

/* Container z-index management */
.container-fluid {
  position: relative;
  z-index: auto;
}

/* Footer */
footer {
  margin-top: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2.5rem;
  }
  
  .stats-section .row > div {
    margin-bottom: 1rem;
  }
  
  .dashboard-container .stat-card {
    margin-bottom: 1rem;
  }
}

/* Utilities */
.bg-gradient {
  background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
}

.text-small {
  font-size: 0.875rem;
}

.shadow-lg {
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* Loading States */
.btn:disabled {
  opacity: 0.6;
  transform: none;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.floating-card {
  animation: float 6s ease-in-out infinite;
}

/* Modern Badge Styling */
.badge {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0.025em;
}

/* Feature Highlights */
.feature-highlight {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Trust Indicators */
.trust-indicator {
  font-size: 0.875rem;
  padding: 0.5rem 0;
}

/* Floating Cards */
.floating-card .bg-glass {
  min-width: 120px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Hero Visual Enhancements */
.hero-visual {
  height: 400px;
}

.main-icon {
  box-shadow: 0 20px 40px rgba(79, 70, 229, 0.2);
}

/* CTA Section */
.cta-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  padding: 3rem !important;
}

.cta-section h2 {
  font-weight: 800;
}

.cta-section .lead {
  color: var(--secondary-color);
}

/* Metrics styling */
.metrics {
  font-size: 0.875rem;
}

.metrics .metric {
  text-align: center;
}

/* Print Styles */
@media print {
  .navbar,
  .btn,
  footer {
    display: none !important;
  }
}