:root {
    /* Colors - Light theme (default) */
    --color-background: #f8f9fa;
    --color-text: #212529;
    --color-primary: #007bff;
    --color-secondary: #6c757d;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #17a2b8;
    --color-light: #f8f9fa;
    --color-dark: #343a40;
    --color-muted: #6c757d;
    --color-border: #dee2e6;
    --color-input-bg: #ffffff;
    --color-input-border: #ced4da;
    --color-card-bg: #ffffff;
    --color-shadow: rgba(0,0,0,0.1);
    --color-firefox-highlight: #e0e0ff;
  }
  
  [data-theme="dark"] {
    --color-background: #121212;
    --color-text: #f8f9fa;
    --color-primary: #2196f3;
    --color-secondary: #9e9e9e;
    --color-success: #4caf50;
    --color-danger: #f44336;
    --color-warning: #ffeb3b;
    --color-info: #00bcd4;
    --color-light: #424242;
    --color-dark: #f8f9fa;
    --color-muted: #9e9e9e;
    --color-border: #424242;
    --color-input-bg: #2c2c2c;
    --color-input-border: #555555;
    --color-card-bg: #1e1e1e;
    --color-shadow: rgba(0,0,0,0.3);
    --color-firefox-highlight: #3a3a57;
  }
  
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    background-color: var(--color-background);
    color: var(--color-text);
    transition: background-color 0.3s ease, color 0.3s ease;
  }
  
  .container {
    width: 100%;
    max-width: 1140px;
    padding: 0 15px;
    margin: 0 auto;
  }
  
  header {
    padding: 3rem 0;
    text-align: center;
  }
  
  .title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
  }
  
  .title a {
    color: var(--color-text);
    text-decoration: none;
  }
  
  .lead {
    font-size: 1.25rem;
    font-weight: 300;
  }
  
  main {
    padding: 1rem 0 3rem;
    min-height: calc(100vh - 220px);
  }
  
  /* Grid and Flexbox Layouts */
  .row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
  }
  
  .col {
    flex: 1 0 0%;
    padding: 0 15px;
  }
  
  .col-center {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 15px;
  }
  
  /* Form elements */
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-input-bg);
    border: 1px solid var(--color-input-border);
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  }
  
  .form-control:focus {
    border-color: var(--color-primary);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
  }
  
  .input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
  }
  
  .input-group .form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
    margin-bottom: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
  
  .input-group-append {
    display: flex;
    margin-left: -1px;
  }
  
  /* Buttons */
  .btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
  }
  
  .btn-outline-dark {
    color: var(--color-dark);
    border-color: var(--color-dark);
    background-color: transparent;
  }
  
  .btn-outline-dark:hover {
    color: var(--color-light);
    background-color: var(--color-dark);
  }
  
  .btn-outline-danger {
    color: var(--color-danger);
    border-color: var(--color-danger);
    background-color: transparent;
  }
  
  .btn-outline-danger:hover {
    color: var(--color-light);
    background-color: var(--color-danger);
  }
  
  .btn-outline-secondary {
    color: var(--color-secondary);
    border-color: var(--color-secondary);
    background-color: transparent;
  }
  
  .btn-outline-secondary:hover {
    color: var(--color-light);
    background-color: var(--color-secondary);
  }
  
  /* File upload */
  .custom-file {
    position: relative;
    display: inline-block;
    width: 100%;
    margin-bottom: 1rem;
  }
  
  .custom-file-input {
    position: relative;
    z-index: 2;
    width: 100%;
    height: calc(1.5em + 1rem + 2px);
    margin: 0;
    opacity: 0;
    cursor: pointer;
  }
  
  .custom-file-label {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1;
    height: calc(1.5em + 1rem + 2px);
    padding: 0.5rem 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-input-bg);
    border: 1px solid var(--color-input-border);
    border-radius: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .custom-file-label::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: block;
    height: calc(1.5em + 1rem);
    padding: 0.5rem 1rem;
    line-height: 1.5;
    color: var(--color-text);
    content: "Navegueu";
    background-color: var(--color-light);
    border-left: 1px solid var(--color-input-border);
    border-radius: 0 0.25rem 0.25rem 0;
  }
  
  /* Progress bar */
  .progress {
    display: flex;
    height: 0.5rem;
    overflow: hidden;
    font-size: 0.75rem;
    background-color: var(--color-light);
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
  }
  
  .progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    background-color: var(--color-secondary);
    transition: width 0.3s ease;
  }
  
  /* Alerts */
  .alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
  }
  
  .alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
  }
  
  .alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
  }
  
  .alert-outline {
    background-color: var(--color-card-bg);
    border: 1px solid var(--color-border);
    box-shadow: 0 .125rem .25rem var(--color-shadow);
    margin-bottom: 10px;
  }
  
  .alert.encrypted {
    color: #155724;
    border-color: #c3e6cb;
  }
  
  .alert.decrypted {
    color: #004085;
    border-color: #b8daff;
  }
  
  /* Footer */
  .footer {
    padding: 1rem 0;
    background-color: var(--color-light);
    text-align: center;
  }
  
  .footer a {
    color: var(--color-text);
    text-decoration: none;
  }
  
  .footer a:hover {
    text-decoration: underline;
  }
  
  /* Theme toggle switch */
  .theme-switch-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.5rem 1rem;
  }
  
  .theme-switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 48px;
  }
  
  .theme-switch input {
    display: none;
  }
  
  .slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
  }
  
  .slider:before {
    background-color: white;
    bottom: 4px;
    content: "";
    height: 16px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 16px;
    border-radius: 50%;
  }
  
  input:checked + .slider {
    background-color: var(--color-primary);
  }
  
  input:checked + .slider:before {
    transform: translateX(24px);
  }
  
  .theme-icon {
    margin-left: 8px;
    font-size: 1.2rem;
  }
  
  /* Loader */
  .loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
  }
  
  .sk-folding-cube {
    margin: 20px auto;
    width: 40px;
    height: 40px;
    position: relative;
    transform: rotateZ(45deg);
  }
  
  .sk-folding-cube .sk-cube {
    float: left;
    width: 50%;
    height: 50%;
    position: relative;
    transform: scale(1.1);
  }
  
  .sk-folding-cube .sk-cube:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-light);
    animation: sk-foldCubeAngle 2.4s infinite linear both;
    transform-origin: 100% 100%;
  }
  
  .sk-folding-cube .sk-cube2 {
    transform: scale(1.1) rotateZ(90deg);
  }
  
  .sk-folding-cube .sk-cube3 {
    transform: scale(1.1) rotateZ(180deg);
  }
  
  .sk-folding-cube .sk-cube4 {
    transform: scale(1.1) rotateZ(270deg);
  }
  
  .sk-folding-cube .sk-cube2:before {
    animation-delay: 0.3s;
  }
  
  .sk-folding-cube .sk-cube3:before {
    animation-delay: 0.6s;
  }
  
  .sk-folding-cube .sk-cube4:before {
    animation-delay: 0.9s;
  }
  
  @keyframes sk-foldCubeAngle {
    0%, 10% {
      transform: perspective(140px) rotateX(-180deg);
      opacity: 0;
    }
    25%, 75% {
      transform: perspective(140px) rotateX(0deg);
      opacity: 1;
    }
    90%, 100% {
      transform: perspective(140px) rotateY(180deg);
      opacity: 0;
    }
  }
  
  /* Small devices (landscape phones) */
  @media (min-width: 576px) {
    .col-sm-12 {
      flex: 0 0 100%;
      max-width: 100%;
    }
  }
  
  /* Medium devices (tablets) */
  @media (min-width: 768px) {
    .col-md-8 {
      flex: 0 0 66.666667%;
      max-width: 66.666667%;
    }
  }
  
  /* Large devices (desktops) */
  @media (min-width: 992px) {
    .col-lg-6 {
      flex: 0 0 50%;
      max-width: 50%;
    }
  }
  
  /* Specific classes for the application */
  .text-dark {
    color: var(--color-dark);
  }

  .text-black {
    color: #000;
  }
  
  .text-muted {
    color: var(--color-muted);
  }
  
  .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }
  
  .btn-xs {
    padding: 0.1rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
  }
  
  .btn-info {
    color: #fff;
    background-color: var(--color-info);
    border-color: var(--color-info);
  }
  
  /* Modal */
  .modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
  }
  
  .modal-content {
    position: relative;
    background-color: var(--color-card-bg);
    margin: 10% auto;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.3rem;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 4px 8px var(--color-shadow);
  }
  
  .modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .close {
    color: var(--color-muted);
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
  }
  
  .close:hover,
  .close:focus {
    color: var(--color-dark);
    text-decoration: none;
    cursor: pointer;
  }
  
  /* Collapse */
  .collapse {
    display: none;
  }
  
  .collapse.show {
    display: block;
  }
  
  /* Nav */
  .navbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background-color: var(--color-light);
  }
  
  .navbar-light {
    background-color: var(--color-light);
  }
  
  .nav {
    display: flex;
    flex-wrap: wrap;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
  }
  
  .nav-item {
    display: list-item;
  }
  
  .nav-link {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
  }
  
  .mx-auto {
    margin-left: auto;
    margin-right: auto;
  }
  
  /* Animations and transitions */
  .transition-fade {
    transition: opacity 0.3s ease-in-out;
  }
  
  .fade-in {
    opacity: 1;
  }
  
  .fade-out {
    opacity: 0;
  }