/* GESTAOLAB - Premium Stylesheet */

/* Theme Variables Definition */
:root {
  --font-primary: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  
  --emerald: #10b981;
  --emerald-hover: #059669;
  --blue: #2563eb;
  --purple: #7c3aed;
  --red: #dc2626;
  
  /* Shared static colors */
  --white: #ffffff;
}

/* Dark Theme Variables (Default) */
.theme-dark {
  --bg-app: #080d16;
  --bg-header: #0f1524;
  --bg-card: #141c2f;
  --bg-card-hover: #19233b;
  --border-color: #222f4c;
  --border-focus: #10b981;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --emerald-light: rgba(16, 185, 129, 0.1);
  --emerald-light-border: rgba(16, 185, 129, 0.2);
  --blue-light: rgba(59, 130, 246, 0.1);
  --purple-light: rgba(139, 92, 246, 0.1);
  --red-light: rgba(239, 68, 68, 0.1);
  
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 15px rgba(16, 185, 129, 0.15);
}

/* Light Theme Variables */
.theme-light {
  --bg-app: #f1f5f9;
  --bg-header: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-color: #e2e8f0;
  --border-focus: #10b981;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --emerald-light: rgba(16, 185, 129, 0.08);
  --emerald-light-border: rgba(16, 185, 129, 0.15);
  --blue-light: rgba(37, 99, 235, 0.08);
  --purple-light: rgba(124, 58, 237, 0.08);
  --red-light: rgba(220, 38, 38, 0.08);
  
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 15px rgba(16, 185, 129, 0.1);
}

/* Base resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Smooth Transitions during Theme Switch */
body, .card, input, select, header, footer, tr, .excel-tab-btn, button {
  transition: background-color var(--transition-normal), 
              border-color var(--transition-normal), 
              color var(--transition-normal),
              box-shadow var(--transition-normal);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Layout System */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Header Styling */
.app-header {
  height: 70px;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 10;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.logo-icon {
  color: var(--emerald);
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.3));
}

.logo span strong {
  color: var(--emerald);
}

.header-backup {
  display: flex;
  gap: 0.5rem;
}

.btn-header-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-header-outline:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-header-outline i {
  width: 14px;
  height: 14px;
}

/* Theme Selector dropdown */
.theme-selector-wrapper {
  display: flex;
  align-items: center;
  position: relative;
}

.theme-icon {
  position: absolute;
  left: 0.75rem;
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
  pointer-events: none;
}

.theme-select {
  appearance: none;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.45rem 1.5rem 0.45rem 2rem;
  outline: none;
  cursor: pointer;
  width: 105px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.9rem;
}

.theme-select:focus {
  border-color: var(--border-focus);
}

.header-date {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--bg-app);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.header-date i {
  width: 14px;
  height: 14px;
  color: var(--emerald);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.content-body {
  padding: 2rem;
  overflow-y: auto;
  flex-grow: 1;
  padding-bottom: 5.5rem; /* space to avoid collision with bottom bar */
}

/* Tab Views toggle */
.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-out;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Grid System */
.grid {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.grid-2 {
  grid-template-columns: 1fr 1.25fr;
}

.grid-1-2 {
  grid-template-columns: 1fr 1.5fr;
}

/* Card Styling */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-header i {
  width: 20px;
  height: 20px;
}

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

.flex-align-center {
  display: flex;
  align-items: center;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

/* Forms styling */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.col-2 {
  grid-column: span 2;
}

label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.currency-symbol {
  position: absolute;
  left: 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 0.65rem 0.9rem 0.65rem 2.25rem;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Custom styling for dropdowns */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 1rem;
  padding-right: 2.25rem;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5);
  cursor: pointer;
}

.theme-dark input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.helper-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Buttons styling */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--emerald);
  color: #0b0f19;
}

.btn-primary:hover {
  background-color: var(--emerald-hover);
  box-shadow: var(--shadow-glow);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
  background-color: var(--bg-card-hover);
}

.btn-action-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-action-icon:hover {
  color: var(--red);
  background-color: var(--red-light);
}

.btn-action-icon i {
  width: 15px;
  height: 15px;
}

.w-full {
  width: 100%;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.form-actions button {
  flex: 1;
}

/* Tables styling */
.table-container {
  overflow-x: auto;
  margin-top: 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-app);
}

.list-view-container {
  max-height: 480px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8rem;
  min-width: 500px;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.text-right {
  text-align: right;
}

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

.badge-employee {
  background-color: var(--emerald-light);
  color: var(--emerald);
  border: 1px solid var(--emerald-light-border);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  width: 30px;
  height: 30px;
  margin-bottom: 0.5rem;
  stroke-width: 1.5;
}

.empty-state p {
  font-size: 0.8rem;
}

/* Control Panel Card */
.panel-controls-card {
  margin-bottom: 1.25rem;
  padding: 1rem 1.5rem;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.header-actions {
  display: flex;
  align-items: center;
}

.input-search {
  padding: 0.45rem 0.85rem;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.75rem;
  width: 220px;
  outline: none;
}

.input-search:focus {
  border-color: var(--border-focus);
}

/* Metrics Grid styling */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-md);
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon i {
  width: 20px;
  height: 20px;
}

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 800;
  margin-top: 0.15rem;
}

/* Excel Style Bottom Navigation Bar */
.excel-footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background-color: var(--bg-header);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.excel-tabs-container {
  display: flex;
  align-items: flex-end;
  padding-left: 1.5rem;
  height: 100%;
}

.excel-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-bottom: none;
  padding: 0.4rem 1.1rem;
  margin-right: 3px;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  height: calc(100% - 4px);
  position: relative;
  outline: none;
}

.excel-tab-btn:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-primary);
}

.excel-tab-btn i {
  width: 14px;
  height: 14px;
}

.excel-tab-btn.active {
  background-color: var(--bg-card);
  color: var(--emerald);
  border-top: 3px solid var(--emerald);
  border-left-color: var(--border-color);
  border-right-color: var(--border-color);
  height: 100%;
  z-index: 5;
  font-weight: 700;
}

/* Excel Status Bar */
.excel-status-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-right: 1.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.status-ready {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: var(--emerald);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px var(--emerald);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Toast System styling */
.toast-container {
  position: fixed;
  bottom: 4rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 150;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border-left: 4px solid var(--text-muted);
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  animation: slideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 250px;
  max-width: 380px;
}

.toast.success {
  border-left-color: var(--emerald);
}
.toast.success i {
  color: var(--emerald);
}
.toast.error {
  border-left-color: var(--red);
}
.toast.error i {
  color: var(--red);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
  animation: fadeOut 0.2s ease-out forwards;
}

@keyframes fadeOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* Responsiveness Adjustments */
@media (max-width: 980px) {
  .grid-2, .grid-1-2 {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

@media (max-width: 820px) {
  .app-header {
    height: auto;
    flex-direction: column;
    padding: 1rem;
    gap: 0.85rem;
    align-items: center;
    text-align: center;
  }
  
  .header-right {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 0.75rem;
  }
  
  .content-body {
    padding: 1.25rem;
    padding-bottom: 5.5rem;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

@media (max-width: 650px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  
  .form-group, 
  .form-group.col-2, 
  .form-group.col-2-tablet {
    grid-column: span 1 !important;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .excel-tabs-container {
    padding-left: 0.5rem;
  }
  
  .excel-tab-btn {
    padding: 0.4rem 0.65rem;
    font-size: 0.7rem;
    gap: 0.25rem;
  }
  
  .excel-tab-btn span {
    display: none;
  }
  .excel-tab-btn.active span {
    display: inline;
  }

  .excel-status-bar {
    padding-right: 0.5rem;
    gap: 0.5rem;
  }
  
  .excel-status-bar .app-version {
    display: none;
  }
}

@media (min-width: 1500px) {
  .content-body {
    padding-top: 3rem;
  }
  .tab-content {
    max-width: 1500px;
  }
}

/* Pagination Controls Styling */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

.btn-pagination {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-pagination:hover:not(:disabled) {
  background-color: var(--bg-card-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-pagination:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-pagination i {
  width: 14px;
  height: 14px;
}

.pagination-info {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Collapse controls grid on medium/small screens */
@media (max-width: 820px) {
  .controls-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}
