/* Main Application Styles for Grant Management System */
/* Built on Material Design 3 Foundation */

/* ========================================
   BRAND CUSTOMIZATIONS
   ======================================== */

.brand-text {
  font-size: 1.25rem;
  line-height: 1;
}

.brand-text .fw-light {
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 87%, transparent);
}

/* ========================================
   PAGE LAYOUTS & COMPONENTS
   ======================================== */

/* Page Headers */
.page-header {
  background: linear-gradient(135deg, 
    var(--md-sys-color-primary-container) 0%, 
    var(--md-sys-color-secondary-container) 100%);
  color: var(--md-sys-color-on-primary-container);
  padding: 48px 0;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><radialGradient id="a" cx="50%" cy="0%" r="100%"><stop offset="0%" stop-color="%23ffffff" stop-opacity="0.1"/><stop offset="100%" stop-color="%23ffffff" stop-opacity="0"/></radialGradient></defs><rect width="100" height="20" fill="url(%23a)"/></svg>');
  pointer-events: none;
}

.page-header .container-xxl {
  position: relative;
  z-index: 1;
}

/* Enhanced Cards */
.card-dashboard {
  background: linear-gradient(145deg, 
    var(--md-sys-color-surface-container-low) 0%, 
    var(--md-sys-color-surface-container) 100%);
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.card-dashboard:hover {
  box-shadow: var(--md-sys-elevation-level3);
  transform: translateY(-2px);
  border-color: var(--md-sys-color-primary);
}

.card-stats {
  position: relative;
  overflow: hidden;
}

.card-stats::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, 
    var(--md-sys-color-primary), 
    var(--md-sys-color-tertiary));
}

.card-proposal {
  border-left: 4px solid var(--md-sys-color-primary);
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.card-proposal:hover {
  border-left-color: var(--md-sys-color-secondary);
  box-shadow: var(--md-sys-elevation-level2);
}

/* Status Indicators */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: var(--md-sys-typescale-label-small-size);
  font-weight: var(--md-sys-typescale-label-small-weight);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.status-draft {
  background-color: var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
}

.status-badge.status-submitted {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.status-badge.status-under-review {
  background-color: var(--md-sys-color-warning-container);
  color: var(--md-sys-color-on-warning-container);
}

.status-badge.status-approved {
  background-color: var(--md-sys-color-success-container);
  color: var(--md-sys-color-on-success-container);
}

.status-badge.status-rejected {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

/* Progress Indicators */
.progress-circle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
}

.progress-circle svg {
  width: 64px;
  height: 64px;
  transform: rotate(-90deg);
}

.progress-circle .progress-bg {
  fill: none;
  stroke: var(--md-sys-color-outline-variant);
  stroke-width: 4;
}

.progress-circle .progress-fg {
  fill: none;
  stroke: var(--md-sys-color-primary);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s cubic-bezier(0.2, 0, 0, 1);
}

.progress-text {
  position: absolute;
  font-size: var(--md-sys-typescale-label-small-size);
  font-weight: var(--md-sys-typescale-label-small-weight);
  color: var(--md-sys-color-on-surface);
}

/* Form Enhancements */
.form-floating {
  position: relative;
}

.form-floating > .form-control {
  height: 56px;
  padding-top: 20px;
  padding-bottom: 4px;
  background-color: var(--md-sys-color-surface-container-highest);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-extra-small);
}

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

.form-floating > label {
  padding: 16px 12px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-large-size);
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  transform: scale(0.85) translateY(-0.5rem);
  color: var(--md-sys-color-primary);
}

.input-group {
  position: relative;
}

.input-group-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-sys-color-on-surface-variant);
  z-index: 5;
}

.input-group .form-control {
  padding-left: 48px;
}

/* Data Tables */
.table-material {
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-small);
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-level1);
}

.table-material thead th {
  background-color: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  border: none;
  padding: 16px;
  font-weight: var(--md-sys-typescale-title-medium-weight);
  font-size: var(--md-sys-typescale-title-medium-size);
}

.table-material tbody td {
  border: none;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding: 16px;
  vertical-align: middle;
}

.table-material tbody tr:hover {
  background-color: var(--md-sys-color-surface-container-high);
}

/* Navigation Breadcrumbs */
.breadcrumb {
  background-color: transparent;
  padding: 0;
  margin-bottom: 24px;
}

.breadcrumb-item {
  font-size: var(--md-sys-typescale-body-medium-size);
  color: var(--md-sys-color-on-surface-variant);
}

.breadcrumb-item.active {
  color: var(--md-sys-color-on-surface);
  font-weight: var(--md-sys-typescale-body-medium-weight);
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "\e5cc";
  font-family: 'Material Symbols Outlined';
  color: var(--md-sys-color-on-surface-variant);
  font-size: 16px;
}

/* Search and Filters */
.search-container {
  position: relative;
  max-width: 400px;
}

.search-input {
  padding-left: 48px;
  height: 48px;
  border-radius: var(--md-sys-shape-corner-full);
  background-color: var(--md-sys-color-surface-container-highest);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.search-input:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--md-sys-color-primary) 16%, transparent);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-sys-color-on-surface-variant);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-small);
  font-size: var(--md-sys-typescale-label-large-size);
  color: var(--md-sys-color-on-surface-variant);
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  cursor: pointer;
}

.filter-chip:hover {
  background-color: var(--md-sys-color-surface-container);
  border-color: var(--md-sys-color-primary);
}

.filter-chip.active {
  background-color: var(--md-sys-color-secondary-container);
  border-color: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary-container);
}

/* Timeline Components */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--md-sys-color-outline-variant);
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--md-sys-color-primary);
  border: 3px solid var(--md-sys-color-surface);
  box-shadow: 0 0 0 2px var(--md-sys-color-outline-variant);
}

.timeline-content {
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-small);
  padding: 16px;
  box-shadow: var(--md-sys-elevation-level1);
}

/* Action Bars */
.action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background-color: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-small);
  margin-bottom: 24px;
}

.action-bar .btn {
  min-height: 36px;
  padding: 8px 16px;
}

/* Modals */
.modal-content {
  border: none;
  border-radius: var(--md-sys-shape-corner-large);
  background-color: var(--md-sys-color-surface-container-low);
  box-shadow: var(--md-sys-elevation-level5);
}

.modal-header {
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  padding: 24px 24px 16px 24px;
}

.modal-title {
  font-family: var(--md-sys-typescale-headline-small-font);
  font-size: var(--md-sys-typescale-headline-small-size);
  font-weight: var(--md-sys-typescale-headline-small-weight);
  color: var(--md-sys-color-on-surface);
}

.modal-body {
  padding: 16px 24px;
}

.modal-footer {
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding: 16px 24px 24px 24px;
  gap: 12px;
}

/* Loading States */
.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--md-sys-color-outline-variant);
  border-top: 3px solid var(--md-sys-color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, 
    var(--md-sys-color-surface-container) 25%, 
    var(--md-sys-color-surface-container-high) 50%, 
    var(--md-sys-color-surface-container) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--md-sys-shape-corner-extra-small);
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--md-sys-color-on-surface-variant);
}

.empty-state .material-symbols-outlined {
  font-size: 64px;
  opacity: 0.4;
  margin-bottom: 16px;
  display: block;
}

.empty-state-title {
  font-size: var(--md-sys-typescale-headline-small-size);
  font-weight: var(--md-sys-typescale-headline-small-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: var(--md-sys-typescale-body-large-size);
  margin-bottom: 24px;
}

/* Responsive Utilities */
@media (max-width: 768px) {
  .page-header {
    padding: 32px 0;
    margin-bottom: 24px;
  }
  
  .search-container {
    max-width: 100%;
  }
  
  .action-bar {
    flex-wrap: wrap;
    padding: 12px;
  }
  
  .timeline {
    padding-left: 24px;
  }
  
  .timeline::before {
    left: 12px;
  }
  
  .timeline-item::before {
    left: -18px;
  }
}

/* Print Styles */
@media print {
  .navbar,
  .action-bar,
  .btn,
  .modal,
  .offcanvas {
    display: none !important;
  }
  
  .page-header {
    background: none !important;
    color: black !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    break-inside: avoid;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .card {
    border: 2px solid var(--md-sys-color-outline);
  }
  
  .btn {
    border-width: 2px;
  }
  
  .form-control {
    border-width: 2px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}