/**
 * CSMO Financial Management System - Main CSS File
 * Enhanced for mobile responsiveness and modern design
 */

:root {
  --primary-color: #4361ee;
  --primary-light: #4895ef;
  --primary-dark: #3f37c9;
  --secondary-color: #4f4f4f;
  --success-color: #4cc9a0;
  --info-color: #4cc9f0;
  --warning-color: #f8961e;
  --danger-color: #ef476f;
  --light-color: #f8f9fc;
  --dark-color: #212529;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  --border-radius: 0.5rem;
  --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --transition: all 0.3s ease;
  --sidebar-width: 250px;
  --sidebar-width-collapsed: 70px;
}
/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: "Roboto", sans-serif;
  background-color: var(--light-color);
  color: #5a5c69;
  overflow-x: hidden;
}

.wrapper {
  display: flex;
  width: 100%;
  align-items: stretch;
  min-height: 100vh;
}

.container-fluid {
  padding-right: 2rem;
  padding-left: 2rem;
}

.main-content {
  width: 100%;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.sidebar.collapsed + .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

@media (max-width: 991.98px) {
  .main-content {
    margin-left: 0;
    padding-top: 1rem;
  }

  .sidebar.collapsed + .main-content {
    margin-left: 0;
  }

  .container-fluid {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 1040;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

.topbar {
  height: var(--topbar-height);
  box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.sidebar-toggle {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.sidebar-toggle:hover {
  background-color: rgba(78, 115, 223, 0.1);
  color: var(--primary);
}

.app-title {
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.user-dropdown img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.user-dropdown .dropdown-menu {
  min-width: 14rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  border: none;
  border-radius: 0.5rem;
}

.notification-dropdown {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  border: none;
  border-radius: 0.5rem;
}

.notification-badge {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  transform: translate(25%, -25%);
}

.sidebar {
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background: linear-gradient(180deg, #4e73df 0%, #3a56b5 100%);
  color: #fff;
  transition: all 0.3s ease;
  height: 100vh;
  position: fixed;
  z-index: 1030;
  box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.sidebar.collapsed {
  min-width: var(--sidebar-collapsed-width);
  max-width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-header img {
  max-width: 50px;
}

.sidebar.collapsed .nav-item span,
.sidebar.collapsed .dropdown-toggle::after {
  display: none;
}

.sidebar-header {
  padding: 1.5rem 1rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  max-width: 150px;
  height: auto;
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
}

.sidebar-nav {
  padding: 0;
  list-style: none;
  margin-bottom: 0;
}

.sidebar-nav .nav-item {
  position: relative;
  margin-bottom: 0;
}

.sidebar-nav .nav-link {
  padding: 0.8rem 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
  border-left-color: #fff;
}

.sidebar-nav .nav-link i {
  margin-right: 0.75rem;
  width: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.sidebar-nav .submenu {
  padding-left: 0;
  list-style: none;
  background-color: rgba(0, 0, 0, 0.1);
  margin: 0;
}

.sidebar-nav .submenu .nav-link {
  padding: 0.6rem 1rem 0.6rem 3rem;
  font-size: 0.85rem;
  border-left: 4px solid transparent;
}

.sidebar-nav .submenu .nav-link:hover,
.sidebar-nav .submenu .nav-link.active {
  border-left-color: #fff;
}

.footer {
  margin-top: auto;
  padding: 1rem 0;
  background-color: #fff;
  border-top: 1px solid #e3e6f0;
  font-size: 0.875rem;
}

@media (max-width: 767.98px) {
  .footer {
    text-align: center;
  }
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.required-field::after {
  content: "*";
  color: var(--danger);
  margin-left: 4px;
}

.form-control,
.form-select {
  border-radius: 0.5rem;
  border-color: #d1d3e2;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: #bac8f3;
  box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.25);
}

.input-group {
  border-radius: 0.5rem;
  overflow: hidden;
}

.input-group-text {
  background-color: var(--light-color);
  border-color: #d1d3e2;
}

.btn {
  border-radius: 0.5rem;
  padding: 0.5rem 1.25rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

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

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

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.card {
  border: 0;
  border-radius: 0.75rem;
  box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
  transition: all 0.3s ease;
  border-color: var(--primary-color);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  margin-top: 1rem;
}

.dataTables_wrapper .dataTables_length select {
  padding: 0.375rem 1.75rem 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_filter input {
  margin-left: 0.5rem;
}

@media (max-width: 991.98px) {
  .container-fluid {
    padding: 1rem;
  }
  .card {
    margin-bottom: 1rem;
  }
  .table-responsive {
    margin-bottom: 0;
  }
}

@media print {
  .no-print {
    display: none !important;
  }
  .table {
    border: 1px solid #dee2e6;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
  }
}

/* Logo styling */
.sidebar-logo {
  max-width: 100%;
  height: auto;
  max-height: 60px;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  transition: var(--transition);
}

/* Logo in login page */
.login-logo {
  max-height: 80px;
  width: auto;
  object-fit: contain;
  margin-bottom: 1.5rem;
}

/* Logo in home page */
.home-logo {
  max-height: 120px;
  width: auto;
  object-fit: contain;
}

/* Custom Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.5s ease-in-out;
}

.animate-slideInUp {
  animation: slideInUp 0.5s ease-in-out;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

/* Dashboard Specific Styles */
.dashboard-header {
  padding: 1.5rem 0 2rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.dashboard-header .title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.dashboard-header .subtitle {
  font-size: 1rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

.dashboard-header .date-range {
  font-size: 0.875rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
}

.dashboard-section {
  margin-bottom: 2.5rem;
}

.dashboard-section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

.dashboard-row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -0.75rem;
  margin-left: -0.75rem;
  margin-bottom: 1.5rem;
}

.dashboard-col {
  flex: 0 0 100%;
  max-width: 100%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
  margin-bottom: 1.5rem;
}

.dashboard-col-md {
  flex: 0 0 100%;
  max-width: 100%;
}

.dashboard-col-lg {
  flex: 0 0 100%;
  max-width: 100%;
}

.dashboard-col-xl {
  flex: 0 0 100%;
  max-width: 100%;
}

@media (min-width: 768px) {
  .dashboard-col-md {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

@media (min-width: 992px) {
  .dashboard-col-lg {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

@media (min-width: 1200px) {
  .dashboard-col-xl {
    flex: 0 0 25%;
    max-width: 25%;
  }
}

.stat-card {
  border-radius: var(--border-radius);
  padding: 1.5rem;
  height: 100%;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
}

.stat-card .stat-icon {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 3rem;
  opacity: 0.15;
}

.stat-card .stat-title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.stat-card .stat-change {
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  z-index: 1;
}

.stat-card .stat-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
}

.primary-card {
  background: linear-gradient(
    45deg,
    var(--primary-color),
    var(--primary-light)
  );
  color: white;
}

.success-card {
  background: linear-gradient(45deg, var(--success-color), #6ad5b7);
  color: white;
}

.info-card {
  background: linear-gradient(45deg, var(--info-color), #7ad8f5);
  color: white;
}

.warning-card {
  background: linear-gradient(45deg, var(--warning-color), #fbb374);
  color: white;
}

.danger-card {
  background: linear-gradient(45deg, var(--danger-color), #f37a96);
  color: white;
}

/* Card enhancements */
.card {
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
  height: 100%;
}

.card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1.25rem 1.5rem;
}

.card-header h6 {
  margin-bottom: 0;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  background-color: transparent;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1rem 1.5rem;
}

/* Responsive Tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
  .table-responsive-cards thead {
    display: none;
  }

  .table-responsive-cards tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    background-color: #fff;
  }

  .table-responsive-cards tbody tr:hover {
    background-color: var(--gray-100);
  }

  .table-responsive-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    padding: 0.5rem 0;
    text-align: right;
  }

  .table-responsive-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    text-align: left;
    color: var(--gray-700);
  }

  .dashboard-header {
    padding: 1rem 0 1.5rem;
  }

  .dashboard-header .title {
    font-size: 1.5rem;
  }

  .dashboard-section-title {
    font-size: 1.125rem;
    margin-bottom: 1rem;
  }

  .card-header {
    padding: 1rem 1.25rem;
  }

  .card-body {
    padding: 1.25rem;
    height: 250px ;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Footer styling */
.footer {
  margin-top: 2rem;
  padding: 1.5rem 0;
  background-color: #fff;
  border-top: 1px solid var(--gray-200);
  position: relative;
  width: 100%;
  clear: both;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.footer-brand {
  font-weight: 600;
  color: var(--primary-color);
}

@media (max-width: 767.98px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
}
