/* ============================================================================
   OPLEX ADMIN GLOBAL SYSTEM v4.0 FINAL
   Czysta implementacja - unified layout + animations + polish
   ============================================================================ */

/* ==========================================
   GLOBAL LAYOUT - 1200px CENTERED SYSTEM
   ========================================== */

/* Główne kontenery nawigacji i zawartości */
.navigation-bar,
.sub-tabs,
.sub-tabs-secondary {
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

/* Grid containers */
.employees-grid,
.weeks-container {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Payroll specific */
#payrollHeroContainer,
#payrollResults,
#payrollHistoryList,
#payrollStartConfig {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Absences */
#absencesList {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Integration panel */
.integration-panel {
  max-width: 1200px;
  margin: 0 auto;
}

/* Analyzer views - wszystkie główne kontenery */
#analyzerInPostView .analyzer-upload-card,
#analyzerInPostView #inpostSummary,
#analyzerInPostView #inpostReport,
#analyzerAdsView .analyzer-upload-card,
#analyzerAdsView #adsExport,
#analyzerAdsView #adsDashboard,
#analyzerAdsView #adsFilters,
#analyzerAdsView #adsTable,
#analyzerBillingView .analyzer-upload-card,
#analyzerBillingView #billingSummary,
#analyzerBillingView #billingReport {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

#analyzerOfferView .premium-card {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Profitability views */
#profitabilityBusinessView > div,
#profitabilityOfferView > div {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Audit */
#auditLogsContainer {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================
   COSTS MODULE SPECIFIC
   ========================================== */

/* Costs warning box */
.costs-warning-box {
  width: auto;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  padding: 32px;
  border-radius: 12px;
  color: #000;
  border: 2px solid #fbbf24;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  line-height: 1.4;
  font-weight: 500;
  box-sizing: border-box;
}

/* === COSTS WARNING TYPOGRAPHY FIX === */
.costs-warning-box > div > div > div:first-child {
  font-weight: 700;      /* WIDOK ANALITYCZNY */
  font-size: 1.05rem;
}

/* zmniejszenie "oddechu" między akapitami */
.costs-warning-box br + br {
  display: block;
  content: "";
  margin-top: 4px;
}

/* ========================================================================
   COSTS TOP ROW - equal width & height cards
   ======================================================================== */

.costs-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.costs-top-row > .costs-warning-box,
.costs-top-row > .costs-source-card {
  height: 100%;
}

/* Force black text on warning card (all descendants) */
.costs-warning-box,
.costs-warning-box * {
  color: #000 !important;
}

/* Costs source card - już ma styling w premium-components.css */
.costs-source-card {
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  padding: 32px;
  box-sizing: border-box;
}

/* Rozbicie analityczne container */
#costsView > div[style*="background"] {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================
   ANIMATIONS & TRANSITIONS
   ========================================== */

/* Smooth page transitions */
.tab-content {
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.tiles-admin > .tile:nth-child(1) { animation: fadeInUp 0.4s 0.05s cubic-bezier(0.4, 0, 0.2, 1) backwards; }
.tiles-admin > .tile:nth-child(2) { animation: fadeInUp 0.4s 0.1s cubic-bezier(0.4, 0, 0.2, 1) backwards; }
.tiles-admin > .tile:nth-child(3) { animation: fadeInUp 0.4s 0.15s cubic-bezier(0.4, 0, 0.2, 1) backwards; }

/* Smooth transitions dla interaktywnych elementów */
.tile,
.premium-card,
.week-card-payroll,
.integration-card,
.setting-card,
button:not(.no-transition) {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   LOADING STATES
   ========================================== */

.skeleton-loading {
  background: linear-gradient(
    90deg,
    rgba(31, 41, 55, 0.8) 25%,
    rgba(55, 65, 81, 0.8) 50%,
    rgba(31, 41, 55, 0.8) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: 12px;
  min-height: 100px;
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 3px;
  border-radius: 4px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

button:focus-visible,
.sub-tab:focus-visible,
.btn-nav:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(31, 41, 55, 0.3);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.5);
  border-radius: 5px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.7);
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 1240px) {
  .navigation-bar,
  .sub-tabs,
  .sub-tabs-secondary,
  .employees-grid,
  .weeks-container,
  .integration-panel,
  #payrollHeroContainer,
  #payrollResults,
  #absencesList {
    max-width: calc(100% - 40px);
    margin-left: 20px;
    margin-right: 20px;
  }
}

@media (max-width: 768px) {
  .employees-grid > .employee-card,
  .tiles-admin > .tile {
    animation-delay: 0s !important;
  }
}

/* ==========================================
   PERFORMANCE
   ========================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================
   POLISH
   ========================================== */

html {
  scroll-behavior: smooth;
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  animation: fadeInUp 0.5s ease;
}

.empty-state::before {
  content: '';
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.85 8.5l7.15-5.5 7.15 5.5M12 22v-9M5.5 8.5l1.5-1.17a2.83 2.83 0 0 1 3.86 0l1.28 1.17M18.5 8.5l-1.5-1.17a2.83 2.83 0 0 0-3.86 0l-1.28 1.17'/%3E%3C/svg%3E") no-repeat center/contain;
  opacity: 0.5;
}

/* ENTERPRISE PATCH — HARD EDGES */
*,
*::before,
*::after {
  border-radius: 0 !important;
}
