:root {
  /* Color system */
  --primary-color: #0d3d65;
  --secondary-color: #0d6efd;
  --background-color: #f8f8f8;
  --navbar-color: #d2edf2;
  --card-background: white;
  --text-color: #333;
  --text-secondary: #4b5563;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --border-color: #e5e7eb;

  /* Shadows */
  --card-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 .125rem .25rem rgba(0, 0, 0, 0.075);
  --shadow: 0 .5rem 1rem rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);

  /* Border radius */
  --border-radius: 0.5rem;
  --border-radius-sm: 0.25rem;
  --border-radius-lg: 0.75rem;

  /* Typography */
  --font-family: "Roboto Condensed", sans-serif;
  --font-size-normal: 1rem;
  --font-size-large: 1.2rem;
  --font-size-xlarge: 1.5rem;
  --font-weight-normal: 400;
  --font-weight-bold: 700;
  --line-height: 1.5;

  /* Layout */
  --navbar-height: 60px;
  --container-padding: 1.5rem;
  --grid-gap: 1.5rem;
  --card-padding: 1.25rem;

  /* Transitions */
  --transition-speed: 0.2s;
  --transition-timing: ease;
}

/* Base styles */
html {
  font-size: 16px;
  height: 100%;
  box-sizing: border-box;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-normal);
  line-height: var(--line-height);
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding-top: var(--navbar-height);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

h1 {
  font-size: calc(var(--font-size-xlarge) * 1.5);
}

h2 {
  font-size: calc(var(--font-size-xlarge) * 1.2);
}

h3 {
  font-size: var(--font-size-xlarge);
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color var(--transition-speed) var(--transition-timing);
}

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

/* Navbar */
.navbar {
  background-color: var(--navbar-color);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1030;
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  padding: 0 1rem;
}



.navbar-container {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
}

.navbar-header {
  display: flex;
  align-items: center;
  height: 100%;
}

.navbar-brand {
  display: inline-block;
  padding-top: 0.3125rem;
  padding-bottom: 0.3125rem;
  margin-right: 1rem;
  font-size: var(--font-size-xlarge);
  line-height: inherit;
  white-space: nowrap;
}

.logo-container {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 5px 0;
}

.logo-img {
  height: auto;
  max-height: 50px;
  width: auto;
  padding: 0;
  margin: 0;
  transition: transform var(--transition-speed) var(--transition-timing);
}

.logo-img:hover {
  transform: scale(1.05);
}

.navbar-toggle {
  padding: 0.25rem 0.75rem;
  font-size: 1.25rem;
  line-height: 1;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  display: none;
}

.navbar-collapse {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-grow: 1;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.user-info {
  display: flex;
  align-items: center;
  margin-right: 1rem;
}

.username {
  font-weight: 600;
  margin-left: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: var(--font-size-normal);
  line-height: 1.5;
  border-radius: var(--border-radius);
  transition: all var(--transition-speed) var(--transition-timing);
  cursor: pointer;
}

.btn:focus,
.btn:hover {
  text-decoration: none;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

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

.btn-primary:hover {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  transform: translateY(-2px);
}

.btn-secondary {
  color: #fff;
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
}

.btn-danger {
  color: #fff;
  background-color: var(--danger-color);
  border-color: var(--danger-color);
}

.btn-success {
  color: #fff;
  background-color: var(--success-color);
  border-color: var(--success-color);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: var(--border-radius-sm);
}

/* Cards */
.card-box {
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  padding: var(--card-padding);
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform var(--transition-speed) var(--transition-timing), box-shadow var(--transition-speed)
    var(--transition-timing);
  cursor: pointer;
}

.card-box:hover {
  transform: translateY(-3px);
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);
}

.image-box {
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
  border-radius: calc(var(--border-radius) - 2px);
}

.img-responsive {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 0.3s ease;
}

.image-box:hover .img-responsive {
  transform: scale(1.05);
}

/* App grid */
.portfolio-item {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* App placeholder for when no logo is available */
.app-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--light-color);
  color: var(--primary-color);
  font-size: 3rem;
  font-weight: bold;
}

/* Loading states */
/* Keep all existing CSS in modern.css unchanged, only update the loading animation section */

/* Loading states - updated with modern animation */
.loading {
  display: none;
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--background-color);
  z-index: 1000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  width: 100%;
}

.loading-txt {
  font-size: var(--font-size-xlarge);
  margin-bottom: 2rem;
  text-align: center;
  width: 100%;
  color: var(--primary-color);
  font-weight: 500;
}

/* Modern loading animation */
.loading-img {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.loading-img:before,
.loading-img:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--primary-color, #0d3d65);
  opacity: 0.6;
  animation: pulse-shadow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.loading-img:after {
  animation-delay: -1s;
}

.loading-img:before {
  animation-delay: -0.5s;
}

.loading-img span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  margin-left: -8px;
  border-radius: 50%;
  background-color: var(--primary-color, #0d3d65);
  animation: pulse-dot 1.5s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

@keyframes pulse-shadow {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.2);
  }
}

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

.form-control {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: var(--font-size-normal);
  line-height: 1.5;
  color: var(--text-color);
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: var(--border-radius);
  transition: border-color var(--transition-speed) var(--transition-timing), box-shadow var(--transition-speed)
    var(--transition-timing);
}

.form-control:focus {
  color: var(--text-color);
  background-color: #fff;
  border-color: var(--secondary-color);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Alerts */
.alert {
  position: relative;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: var(--border-radius);
}

.alert-success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.alert-danger {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.alert-warning {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeeba;
}

.alert-info {
  color: #0c5460;
  background-color: #d1ecf1;
  border-color: #bee5eb;
}

/* Tables */
.table {
  width: 100%;
  margin-bottom: 1rem;
  color: var(--text-color);
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  vertical-align: top;
  border-top: 1px solid #dee2e6;
}

.table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid #dee2e6;
  background-color: rgba(0, 0, 0, 0.03);
}

.table-bordered {
  border: 1px solid #dee2e6;
}

.table-bordered th,
.table-bordered td {
  border: 1px solid #dee2e6;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.05);
}

.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: 0;
}

.modal-dialog {
  position: relative;
  width: auto;
  margin: 0.5rem;
  pointer-events: none;
  max-width: 500px;
  margin: 1.75rem auto;
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius);
  outline: 0;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #dee2e6;
  border-top-left-radius: calc(var(--border-radius) - 1px);
  border-top-right-radius: calc(var(--border-radius) - 1px);
}

.modal-title {
  margin-bottom: 0;
  line-height: 1.5;
}

.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: 1rem;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  padding: 0.75rem;
  border-top: 1px solid #dee2e6;
  border-bottom-right-radius: calc(var(--border-radius) - 1px);
  border-bottom-left-radius: calc(var(--border-radius) - 1px);
}

.close {
  float: right;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: #000;
  text-shadow: 0 1px 0 #fff;
  opacity: 0.5;
  background-color: transparent;
  border: 0;
  cursor: pointer;
}

/* Utilities */
.container {
  width: 100%;
  padding-right: var(--container-padding);
  padding-left: var(--container-padding);
  margin-right: auto;
  margin-left: auto;
  max-width: 1200px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}

.col,
.col-md-6,
.col-lg-12 {
  position: relative;
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
}

.col {
  flex-basis: 0;
  flex-grow: 1;
  max-width: 100%;
}

.d-flex {
  display: flex !important;
}

.flex-column {
  flex-direction: column !important;
}

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

.justify-content-center {
  justify-content: center !important;
}

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

.text-center {
  text-align: center !important;
}

.mt-4 {
  margin-top: 1.5rem !important;
}

.mb-4 {
  margin-bottom: 1.5rem !important;
}

.py-5 {
  padding-top: 3rem !important;
  padding-bottom: 3rem !important;
}

.w-100 {
  width: 100% !important;
}

.h-100 {
  height: 100% !important;
}

/* Read more functionality */
.card-box p {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  max-height: 4.5em;
  transition: all 0.3s ease;
}

.card-box p.expanded {
  overflow: visible;
  text-overflow: unset;
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  max-height: none;
}

.read-more {
  cursor: pointer;
  color: var(--secondary-color);
  text-decoration: underline;
  font-size: var(--font-size-normal);
  margin-top: 0.5rem;
  display: inline-block;
}

.read-more:hover {
  color: var(--primary-color);
}

/* My apps section */
.myApps-inline {
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  padding: var(--card-padding);
  margin-top: 1.5rem;
}

.myApps-title {
  margin-bottom: 1rem;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.5rem;
}

.myApps {
  margin-bottom: 1rem;
}

.myApps-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
}

/* Badge styling */
.badge {
  display: inline-block;
  padding: 0.25em 0.4em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
}

.bg-primary {
  background-color: var(--primary-color) !important;
  color: white;
}

/* App actions */
.app-actions {
  margin-top: auto;
  padding-top: 1rem;
}

/* Card link styling */
.card-link {
  color: inherit;
  text-decoration: none;
}

.card-link:hover {
  text-decoration: none;
}

/* Responsive adjustments */
@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
  }
}

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

  .navbar-expand-md .navbar-nav {
    flex-direction: row;
  }

  .navbar-expand-md .navbar-collapse {
    display: flex !important;
    flex-basis: auto;
  }

  .navbar-expand-md .navbar-toggler {
    display: none;
  }
}

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

@media (max-width: 767.98px) {
  :root {
    --navbar-height: 60px;
    --font-size-normal: 0.9rem;
    --font-size-large: 1.1rem;
    --font-size-xlarge: 1.3rem;
  }

  .navbar-toggle {
    display: block;
  }

  .navbar-collapse {
    position: absolute;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    background-color: var(--navbar-color);
    flex-direction: column;
    padding: 1rem;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  .navbar-collapse.show {
    display: flex;
  }

  .navbar-right {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .navbar-right .btn {
    margin-bottom: 0.5rem;
    width: 100%;
    text-align: left;
  }

  .user-info {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
  }
}

/* Accessibility improvements */
.btn:focus,
a:focus {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Admin styles */
.admin-monospace {
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.admin-tabs {
  margin-bottom: 1.5rem;
}

.admin-tab-content {
  margin-top: 1rem;
}

/* Footer */
.footer {
  margin-top: auto;
  padding: 2rem 0;
  background-color: var(--navbar-color);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

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

.footer-text {
  margin: 0;
}

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

  .footer-text {
    margin-bottom: 1rem;
  }
}
