/* Therness QMS - Quality Management System
 * Copyright (C) 2025 Therness S.R.L.
 * All rights reserved.
 */

/* Import DM Sans font for distinctive typography */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap');

/* CSS Variables for Therness branding */
:root {
  --therness-primary: #0874a8;
  --therness-primary-dark: #065a84;
  --therness-primary-light: #0a8fcf;
  --therness-secondary: #343a40;
  --therness-accent: #17a2b8;
  --therness-success: #28a745;
  --therness-warning: #ffc107;
  --therness-danger: #dc3545;
  --therness-light: #f8f9fa;
  --therness-dark: #212529;
  --therness-gradient: linear-gradient(135deg, #0874a8 0%, #065a84 100%);
  --therness-shadow: 0 2px 8px rgba(8, 116, 168, 0.15);
  --therness-shadow-hover: 0 4px 16px rgba(8, 116, 168, 0.25);
  --border-radius: 8px;
  --transition-speed: 0.2s;
}

/* Base typography */
html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--therness-secondary);
  background-color: #fafbfc;
}

/* Navbar styling */
.navbar {
  background: var(--therness-gradient) !important;
  box-shadow: var(--therness-shadow);
  padding: 0.5rem 1rem;
}

.navbar-brand {
  padding: 0.25rem 0;
}

.navbar-brand img {
  transition: transform var(--transition-speed) ease;
}

.navbar-brand:hover img {
  transform: scale(1.02);
}

.navbar .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: var(--border-radius);
  transition: all var(--transition-speed) ease;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: #fff !important;
  background-color: rgba(255, 255, 255, 0.15);
}

.navbar .dropdown-menu {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--therness-shadow-hover);
  padding: 0.5rem;
  margin-top: 0.5rem;
}

.navbar .dropdown-menu .nav-link {
  color: var(--therness-secondary) !important;
  border-radius: calc(var(--border-radius) - 2px);
}

.navbar .dropdown-menu .nav-link:hover {
  background-color: var(--therness-light);
  color: var(--therness-primary) !important;
}

.navbar-toggler {
  border-color: rgba(255, 255, 255, 0.5);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Button styling */
.btn {
  border-radius: var(--border-radius);
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  transition: all var(--transition-speed) ease;
}

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

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--therness-primary-dark);
  border-color: var(--therness-primary-dark);
  box-shadow: var(--therness-shadow-hover);
  transform: translateY(-1px);
}

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

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

.btn-link {
  color: var(--therness-primary);
}

.btn-link:hover {
  color: var(--therness-primary-dark);
}

/* Form controls */
.form-control,
.form-select {
  border-radius: var(--border-radius);
  border: 1px solid #dee2e6;
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--therness-primary);
  box-shadow: 0 0 0 0.2rem rgba(8, 116, 168, 0.25);
}

/* Links */
a {
  color: var(--therness-primary);
  transition: color var(--transition-speed) ease;
}

a:hover {
  color: var(--therness-primary-dark);
}

/* Cards */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--therness-shadow);
  transition: box-shadow var(--transition-speed) ease;
}

.card:hover {
  box-shadow: var(--therness-shadow-hover);
}

.card-header {
  background-color: var(--therness-light);
  border-bottom: 1px solid #e9ecef;
  border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

/* Tables */
.table {
  border-radius: var(--border-radius);
  overflow: hidden;
}

.table thead th {
  background-color: var(--therness-primary);
  color: white;
  border: none;
  font-weight: 600;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(8, 116, 168, 0.03);
}

.table-hover tbody tr:hover {
  background-color: rgba(8, 116, 168, 0.08);
}

/* Dashboard cards */
.dashboard {
    float: left;
    width: calc(100% - 800px);
    margin-left: 30px;
  background: white;
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--therness-shadow);
  transition: box-shadow var(--transition-speed) ease;
}

.dashboard:hover {
  box-shadow: var(--therness-shadow-hover);
}

.dashboard h4 {
  color: var(--therness-primary);
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--therness-primary);
}

@media (min-width: 1400px) {
    .dashboard {
        float: left;
        width: calc(100% - 910px);
        margin-left: 30px;
    }
}

@media (max-width: 1200px) {
    .dashboard {
        float: left;
        width: calc(100% - 670px);
        margin-left: 30px;
    }
}

@media (max-width: 1000px) {
    .dashboard {
        float: left;
        width: calc(100% - 100px);
        margin-left: 30px;
    }
}

/* Footer */
.footer {
  background-color: var(--therness-secondary);
  color: rgba(255, 255, 255, 0.8);
  padding: 1rem 0;
}

.footer a {
  color: rgba(255, 255, 255, 0.9);
}

.footer a:hover {
  color: #fff;
}

/* Page headers */
h1, h2, h3, h4, h5, h6 {
  color: var(--therness-secondary);
  font-weight: 600;
}

.display-4 {
  color: var(--therness-primary);
}

/* Alerts */
.alert {
  border-radius: var(--border-radius);
  border: none;
}

.alert-primary {
  background-color: rgba(8, 116, 168, 0.1);
  color: var(--therness-primary-dark);
}

.alert-success {
  background-color: rgba(40, 167, 69, 0.1);
  color: #1e7e34;
}

.alert-danger {
  background-color: rgba(220, 53, 69, 0.1);
  color: #bd2130;
}

.alert-warning {
  background-color: rgba(255, 193, 7, 0.1);
  color: #856404;
}

/* Badge styling */
.badge {
  border-radius: calc(var(--border-radius) / 2);
  font-weight: 500;
  padding: 0.4em 0.8em;
}

.badge-primary,
.bg-primary {
  background-color: var(--therness-primary) !important;
}

/* Pagination */
.pagination .page-link {
  color: var(--therness-primary);
  border-radius: var(--border-radius);
  margin: 0 2px;
}

.pagination .page-item.active .page-link {
  background-color: var(--therness-primary);
  border-color: var(--therness-primary);
}

.pagination .page-link:hover {
  background-color: var(--therness-light);
  color: var(--therness-primary-dark);
}

/* DataTables styling override */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--therness-primary) !important;
  border-color: var(--therness-primary) !important;
  color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--therness-primary-light) !important;
  border-color: var(--therness-primary-light) !important;
  color: white !important;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Focus states for accessibility */
*:focus-visible {
  outline: 2px solid var(--therness-primary);
  outline-offset: 2px;
}

/* Loading animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Container max-width adjustment */
.container {
  max-width: 1400px;
}

/* User greeting in navbar */
.navbar .btn-link {
  color: rgba(255, 255, 255, 0.9) !important;
}

.navbar .btn-link:hover {
  color: #fff !important;
  text-decoration: underline;
}
