/* Import modern fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* CSS Variables for consistent theming */
:root {
  --primary-blue: #4A90E2;
  --primary-blue-light: #6BA3E8;
  --primary-blue-dark: #357ABD;
  --secondary-blue: #E8F4FD;
  --success-green: #27AE60;
  --warning-orange: #F39C12;
  --danger-red: #E74C3C;
  --text-dark: #2C3E50;
  --text-medium: #5A6C7D;
  --text-light: #8492A6;
  --background-light: #F8FAFB;
  --white: #FFFFFF;
  --border-light: #E1E8ED;
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 24px rgba(74, 144, 226, 0.12);
  --border-radius: 12px;
  --border-radius-small: 8px;
  --transition: all 0.3s ease;
  --sidebar-width: 260px;
  --header-height: 70px;
}

/* Base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--background-light);
  color: var(--text-dark);
  line-height: 1.6;
  font-size: 14px;
  overflow-x: hidden;
}

/* Grid layout */
.grid-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    "header header"
    "sidebar main";
  min-height: 100vh;
}

/* Header styles */
.header {
  grid-area: header;
  background-color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: fixed;
  width: 100%;
  height: var(--header-height);
  z-index: 100;
  box-shadow: var(--shadow-light);
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
}

.header-left {
  display: flex;
  align-items: center;
}

.header-left img {
  width: 200px;
  height: auto;
  padding: 2px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right button,
.header-right a {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--background-light);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  text-decoration: none;
}

.header-right button:hover,
.header-right a:hover {
  background-color: var(--secondary-blue);
  color: var(--primary-blue);
}

.menu-icon {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--background-light);
  margin-right: 15px;
}

/* Sidebar styles */

#sidebar {
  position: fixed;
  top: 40px;
  left: 0;
  width: 250px;
  height: 100vh;
}

.sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 20px;
}

.sidebar-title button {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-medium);
}

.sidebar-list {
  padding: 20px 0;
}

.sidebar-list ul {
  list-style: none;
}

.sidebar-list-item {
  margin-bottom: 4px;
  padding: 0 16px;
}

.sidebar-list-item a {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-medium);
  padding: 12px 16px;
  border-radius: var(--border-radius-small);
  transition: var(--transition);
  font-weight: 500;
  font-size: 14px;
}

.sidebar-list-item a span {
  margin-right: 12px;
  font-size: 18px;
}

.sidebar-list-item:hover a {
  background-color: var(--secondary-blue);
  color: var(--primary-blue);
}

.sidebar-list-item.active a {
  background-color: var(--primary-blue);
  color: var(--white);
}

/* Main Container */
.main-container {
  grid-area: main;
  padding: 30px;
  margin-top: 38px;
  overflow-y: auto;
  background-color: var(--background-light);
}

.main-title {
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-light);
  text-align: center;
}

.main-title h2 {
  color: var(--text-dark);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.main-title p {
  color: var(--text-medium);
  font-size: 16px;
  font-weight: 400;
}

/* Config Sections */
.config-section {
  margin-bottom: 40px;
}

.config-section h3 {
  color: var(--text-dark);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-left: 15px;
  border-left: 4px solid var(--primary-blue);
}

/* Config Cards */
.config-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.config-card:hover {
  box-shadow: var(--shadow-medium);
}

.config-card h4 {
  color: var(--text-dark);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-dark);
  font-weight: 500;
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-small);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  background-color: var(--white);
  color: var(--text-dark);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Buttons */
.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--primary-blue);
  color: var(--white);
}

.btn-primary:hover {
  background-color: var(--primary-blue-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn-secondary {
  background-color: var(--text-medium);
  color: var(--white);
}

.btn-secondary:hover {
  background-color: var(--text-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(90, 108, 125, 0.3);
}

/* Table Styles */
.usuarios-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  background-color: var(--white);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-light);
}

.usuarios-table table {
  width: 100%;
  min-width: 600px; /* Largura mínima para manter a legibilidade */
}

.usuarios-table th,
.usuarios-table td {
  padding: 16px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.usuarios-table th {
  background-color: var(--background-light);
  font-weight: 600;
  color: var(--text-dark);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.usuarios-table tr:hover {
  background-color: var(--background-light);
}

.usuarios-table tr:last-child td {
  border-bottom: none;
}

/* Action Buttons */
.btn-edit,
.btn-reset-password,
.btn-deactivate,
.btn-activate {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  margin: 0 2px;
  transition: var(--transition);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-edit {
  color: var(--primary-blue);
}

.btn-edit:hover {
  background-color: var(--secondary-blue);
}

.btn-reset-password {
  color: var(--warning-orange);
}

.btn-reset-password:hover {
  background-color: rgba(243, 156, 18, 0.1);
}

.btn-deactivate {
  color: var(--danger-red);
}

.btn-deactivate:hover {
  background-color: rgba(231, 76, 60, 0.1);
}

.btn-activate {
  color: var(--success-green);
}

.btn-activate:hover {
  background-color: rgba(39, 174, 96, 0.1);
}

/* Backup Options */
.backup-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.backup-item {
  padding: 20px;
  background-color: var(--white);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-light);
  transition: var(--transition);
}

.backup-item:hover {
  box-shadow: var(--shadow-medium);
}

.backup-item h5 {
  color: var(--text-dark);
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 16px;
}

.backup-item p {
  color: var(--text-medium);
  margin-bottom: 15px;
  font-size: 14px;
}

.security-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.security-options label {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--text-dark);
  font-size: 14px;
  font-weight: 500;
}

.security-options input[type="checkbox"] {
  margin-right: 10px;
  width: auto;
  accent-color: var(--primary-blue);
}

/* Logs */
.logs-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  margin-bottom: 15px;
  background-color: var(--white);
}

.log-item {
  display: grid;
  grid-template-columns: 140px 200px 1fr;
  gap: 15px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}

.log-item:last-child {
  border-bottom: none;
}

.log-item:hover {
  background-color: var(--background-light);
}

.log-time {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
}

.log-user {
  font-size: 13px;
  color: var(--text-medium);
  font-weight: 500;
}

.log-action {
  font-size: 13px;
  color: var(--text-dark);
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--white);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-medium);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  color: var(--text-dark);
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  transition: var(--transition);
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  color: var(--danger-red);
  background-color: rgba(231, 76, 60, 0.1);
}

.modal-body {
  padding: 25px;
}

.modal-body p {
  margin-bottom: 20px;
  color: var(--text-medium);
  font-weight: 400;
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px 25px;
  border-top: 1px solid var(--border-light);
  background-color: var(--background-light);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Responsive Design */
@media (max-width: 992px) {
  .main-container {
    padding: 20px;
  }
  
  .backup-options {
    grid-template-columns: 1fr;
  }

  .usuarios-table {
    font-size: 12px;
  }

  .usuarios-table th,
  .usuarios-table td {
    padding: 15px 5px;
  }

}

@media (max-width: 768px) {
  .grid-container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }
  
  .menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
  }
  
  #sidebar {
    position: fixed; 
    top: 0;
    left: -100%; 
    width: 250px;
    height: 100vh;
    background-color: #E1E8ED;
    z-index: 99; 
    transition: left 0.5s ease;
  }
  
  #sidebar.active {
    left: 0;
  }
  
  .sidebar-title button {
    display: block;
  }

  .main-container {
    padding: 20px 15px;
    padding-top: calc(var(--header-height) + 20px);
  }

  .main-title h2 {
    font-size: 24px;
  }

  .log-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .log-time,
  .log-user {
    font-size: 11px;
  }

  .modal-content {
    width: 95%;
    margin: 0 10px;
  }

  .usuarios-table {
    font-size: 12px;
  }

  .usuarios-table th,
  .usuarios-table td {
    padding: 10px 8px;
  }

  .header {
    padding: 0 20px;
  }
}

@media (max-width: 576px) {
  .main-title h2 {
    font-size: 20px;
  }

  .config-section h3 {
    font-size: 18px;
  }

  .config-card {
    padding: 20px 15px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px 12px;
  }

  .header {
    padding: 0 16px;
  }

  .main-container {
    padding: 16px;
  }

  .usuarios-table {
    min-width: 100%;
    display: table;
    overflow-x: visible;
  }
  
  .usuarios-table thead {
    display: none;
  }
  
  .usuarios-table tr {
    display: block;
    margin-bottom: 15px;
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-light);
    overflow: hidden;
  }
  
  .usuarios-table td {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    text-align: right;
    border-bottom: 1px solid var(--border-light);
    white-space: normal;
  }
  
  .usuarios-table td::before {
    font-weight: 600;
    color: var(--text-dark);
    margin-right: auto;
    padding-right: 20px;
    text-align: left;
  }
  
  .usuarios-table td:last-child {
    border-bottom: none;
  }
  
  /* Specific adjustments for action column */
  .usuarios-table td[data-label="Ações"]::before {
    display: none;
  }
  
  .usuarios-table td[data-label="Ações"] {
    justify-content: flex-end;
  }
}

/* Mobile sidebar overlay */

.sidebar-open {
  overflow: hidden;
}

.sidebar-open #sidebar {
  left: 0;
}

.sidebar-open::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 98;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--background-light);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

button:focus,
input:focus,
select:focus,
a:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.config-card {
  animation: fadeIn 0.5s ease forwards;
}

.config-section:nth-child(1) .config-card { animation-delay: 0.1s; }
.config-section:nth-child(2) .config-card { animation-delay: 0.2s; }
.config-section:nth-child(3) .config-card { animation-delay: 0.3s; }
.config-section:nth-child(4) .config-card { animation-delay: 0.4s; }
