/* AI Management App - Stili Globali */

:root {
  --primary: #0d6efd;
  --secondary: #6c757d;
  --success: #198754;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #0dcaf0;
  --dark: #212529;
  --light: #f8f9fa;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
}

/* Navbar */
.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
}

.navbar {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Sidebar - 2 Level Collapsible */
.sidebar {
  min-height: calc(100vh - 56px);
  background-color: #fff;
  border-right: 1px solid #dee2e6;
  padding: 1rem 0;
  transition: all 0.3s ease-in-out;
  position: relative;
}

/* Sidebar States */
.sidebar.icons-only {
  width: 70px !important;
  min-width: 70px !important;
}

.sidebar.full {
  width: auto;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  position: absolute;
  top: 10px;
  right: -15px;
  width: 30px;
  height: 30px;
  background-color: var(--primary);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.3s;
}

.sidebar-toggle:hover {
  background-color: #0b5ed7;
  transform: scale(1.1);
}

.sidebar-toggle i {
  font-size: 0.875rem;
}

/* Nav Links */
.sidebar .nav-link {
  color: #495057;
  padding: 0.75rem 1.5rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background-color: #f8f9fa;
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar .nav-link i {
  margin-right: 0.5rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar .nav-link .link-text {
  transition: opacity 0.3s;
}

/* Icons Only Mode */
.sidebar.icons-only .nav-link {
  padding: 0.75rem;
  justify-content: center;
}

.sidebar.icons-only .nav-link i {
  margin-right: 0;
  font-size: 1.25rem;
}

.sidebar.icons-only .link-text {
  display: none;
}

/* Tooltip for icons-only mode */
.sidebar.icons-only .nav-link {
  position: relative;
}

.sidebar.icons-only .nav-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background-color: #333;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  margin-left: 10px;
  font-size: 0.875rem;
  z-index: 1001;
}

.sidebar.icons-only .nav-link:hover::after {
  opacity: 1;
}

/* Main content */
.main-content {
  padding: 1rem;
  min-height: calc(100vh - 56px);
}

/* Cards */
.card {
  border: none;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
  margin-bottom: 1.5rem;
}

.card-header {
  background-color: #fff;
  border-bottom: 2px solid #f0f0f0;
  font-weight: 600;
}

/* Stats Cards */
.stat-card {
  border-left: 4px solid var(--primary);
}

.stat-card.success {
  border-left-color: var(--success);
}

.stat-card.warning {
  border-left-color: var(--warning);
}

.stat-card.danger {
  border-left-color: var(--danger);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  color: #6c757d;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tables */
.table {
  background-color: #fff;
}

.table thead th {
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  color: #495057;
}

/* Badges */
.badge-api-key {
  font-family: monospace;
  font-size: 0.85rem;
}

/* Buttons */
.btn {
  border-radius: 0.25rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Forms */
.form-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #495057;
}

/* Loading */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-text {
  color: #6c757d;
  font-style: italic;
  text-align: center;
  padding: 2rem;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 70px;
  right: 1rem;
  z-index: 9998;
}

/* Login page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6c757d;
}

.empty-state i {
  font-size: 4rem;
  color: #dee2e6;
  margin-bottom: 1rem;
}

/* JSON editor */
.json-editor {
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  padding: 0.75rem;
  min-height: 200px;
}

/* Masked input */
.masked-input {
  font-family: monospace;
  background-color: #f8f9fa;
}

/* Utility classes */
.text-muted-light {
  color: #adb5bd;
}

.cursor-pointer {
  cursor: pointer;
}

.hover-shadow:hover {
  box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15) !important;
  transition: box-shadow 0.2s;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid #dee2e6;
  }

  .sidebar-toggle {
    display: none;
  }

  .main-content {
    padding: 1rem;
  }

  .stat-value {
    font-size: 2rem;
  }
}
