/* Sportedia Monochromatic Design System CSS (Strict LTR & Modern Rounded Radius) */

:root {
  --sp-primary: #000000;
  --sp-bg-main: #f8f9fa;
  --sp-bg-card: #ffffff;
  --sp-text-main: #111827;
  --sp-text-muted: #6b7280;
  --sp-border-color: #e5e7eb;
  --sp-border-hover: #d1d5db;
  --sp-radius: 12px;
  --sp-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --sp-font: 'Google Sans Flex', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sp-sidebar-width: 260px;
}

* {
  box-sizing: border-box;
}

html, body {
  direction: ltr !important;
  text-align: left !important;
}

body.sportedia-app-body {
  margin: 0;
  padding: 0;
  background-color: var(--sp-bg-main);
  font-family: var(--sp-font);
  color: var(--sp-text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Wrapper Layout */
.sp-app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  direction: ltr !important;
}

/* Floating Sidebar Navigation */
.sp-sidebar-floating {
  position: fixed;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: var(--sp-sidebar-width);
  background: var(--sp-bg-card);
  border: 1px solid var(--sp-border-color);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  padding: 20px 16px;
  overflow-y: auto;
  direction: ltr !important;
  text-align: left !important;
}

.sp-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--sp-border-color);
  justify-content: flex-start;
}

.sp-brand-logo {
  width: 38px;
  height: 38px;
  background: #000000;
  color: #ffffff;
  border-radius: var(--sp-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.sp-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--sp-text-main);
  letter-spacing: -0.5px;
  text-align: left;
}

.sp-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.sp-nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 14px;
  color: var(--sp-text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--sp-radius);
  transition: all 0.2s ease;
  text-align: left;
}

.sp-nav-item:hover {
  background-color: var(--sp-bg-main);
  color: var(--sp-text-main);
}

.sp-nav-item.active {
  background-color: #000000;
  color: #ffffff;
}

.sp-nav-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
}

.sp-sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--sp-border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background-color: var(--sp-bg-main);
  border-radius: var(--sp-radius);
  margin-bottom: 8px;
  justify-content: flex-start;
}

.sp-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--sp-text-main);
  flex-shrink: 0;
}

.sp-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
}

.sp-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--sp-text-main);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sp-user-role {
  font-size: 11px;
  color: var(--sp-text-muted);
}

/* Main Content Area */
.sp-main-content {
  margin-left: calc(var(--sp-sidebar-width) + 32px);
  padding: 24px 32px 32px 0;
  flex-grow: 1;
  max-width: 1400px;
  direction: ltr !important;
  text-align: left !important;
}

.sp-page-header {
  margin-bottom: 24px;
  text-align: left !important;
}

.sp-page-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--sp-text-main);
  letter-spacing: -0.5px;
  text-align: left !important;
}

.sp-page-subtitle {
  font-size: 13px;
  color: var(--sp-text-muted);
  margin: 0;
  text-align: left !important;
}

/* Cards System */
.sp-card {
  background: var(--sp-bg-card);
  border: 1px solid var(--sp-border-color);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow);
  padding: 20px;
  margin-bottom: 20px;
  text-align: left !important;
}

/* Floating Label Inputs & Form Controls */
.sp-form-group {
  position: relative;
  margin-bottom: 16px;
  text-align: left !important;
}

.sp-floating-input, .sp-floating-select, .sp-input, select.sp-floating-select {
  width: 100%;
  height: 46px;
  padding: 12px 14px;
  font-family: var(--sp-font);
  font-size: 13.5px;
  line-height: 1.3;
  color: var(--sp-text-main);
  background-color: var(--sp-bg-card);
  border: 1px solid var(--sp-border-color);
  border-radius: var(--sp-radius);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  direction: ltr !important;
  text-align: left !important;
  vertical-align: middle;
}

select.sp-floating-select, select.sp-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

textarea.sp-floating-input {
  height: auto;
  min-height: 80px;
}

.sp-floating-input:focus, .sp-floating-select:focus, select.sp-floating-select:focus {
  border-color: #000000;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.sp-floating-label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--sp-bg-card);
  padding: 0 4px;
  color: var(--sp-text-muted);
  font-size: 13px;
  pointer-events: none;
  transition: all 0.2s ease;
  direction: ltr !important;
  z-index: 2;
}

.sp-floating-input:focus ~ .sp-floating-label,
.sp-floating-input:not(:placeholder-shown) ~ .sp-floating-label,
.sp-floating-input.has-value ~ .sp-floating-label,
.sp-floating-select:focus ~ .sp-floating-label,
.sp-floating-select:not([value=""]) ~ .sp-floating-label,
.sp-floating-select.has-value ~ .sp-floating-label {
  top: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--sp-text-main);
}

/* Modals */
.sp-modal, .sp-modal-overlay {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
}

.sp-modal.open, .sp-modal.active, .sp-modal-overlay.active, .sp-modal-overlay.open {
  display: flex !important;
}

.sp-modal-content {
  background-color: #ffffff;
  border-radius: var(--sp-radius);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 92%;
  max-width: 768px;
  padding: 24px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  text-align: left !important;
  border: 1px solid var(--sp-border-color);
}

.sp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--sp-border-color);
}

.sp-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--sp-text-main);
}

.sp-modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  color: var(--sp-text-muted);
}

.sp-modal-close:hover {
  color: var(--sp-text-main);
}

.sp-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.sp-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 640px) {
  .sp-grid-2, .sp-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Data Tables */
.sp-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--sp-border-color);
  border-radius: var(--sp-radius);
  background: var(--sp-bg-card);
  direction: ltr !important;
}

.sp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left !important;
  font-size: 13px;
  direction: ltr !important;
}

.sp-table th {
  background-color: var(--sp-bg-main);
  color: var(--sp-text-muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--sp-border-color);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left !important;
}

.sp-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--sp-border-color);
  color: var(--sp-text-main);
  text-align: left !important;
  vertical-align: middle;
}

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

.sp-table tr:hover td {
  background-color: #fafafa;
}

/* Badges */
.sp-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--sp-border-color);
  background: var(--sp-bg-main);
  color: var(--sp-text-main);
}

.sp-badge-active {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.sp-badge-inactive {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

/* Buttons */
.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--sp-radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: var(--sp-font);
  direction: ltr !important;
}

.sp-btn-primary {
  background-color: #000000;
  color: #ffffff;
}

.sp-btn-primary:hover {
  background-color: #222222;
}

.sp-btn-secondary {
  background-color: #ffffff;
  color: var(--sp-text-main);
  border-color: var(--sp-border-color);
}

.sp-btn-secondary:hover {
  background-color: var(--sp-bg-main);
  border-color: var(--sp-border-hover);
}

.sp-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* Mobile Responsive Adjustments */
.sp-mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1001;
  background: #000000;
  color: #ffffff;
  border: none;
  border-radius: var(--sp-radius);
  padding: 10px;
  cursor: pointer;
}

@media (max-width: 991px) {
  .sp-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sp-sidebar-floating {
    transform: translateX(-120%);
    transition: transform 0.3s ease;
    top: 0;
    left: 0;
    bottom: 0;
    border-radius: 0;
    height: 100vh;
  }

  .sp-sidebar-floating.open {
    transform: translateX(0);
  }

  .sp-main-content {
    margin-left: 0;
    padding: 72px 16px 24px 16px;
  }
}

/* Printable Invoice, Card & Payroll Report CSS Rules */
@media print {
  @page {
    size: A5 portrait;
    margin: 5mm;
  }

  body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hide everything on page by default during print */
  body * {
    visibility: hidden !important;
  }

  /* Show active modal container and all its descendants */
  #spInvoiceModal.active, #spInvoiceModal.active *,
  #spInvoiceModal.open, #spInvoiceModal.open *,
  #spCardModal.active, #spCardModal.active *,
  #spCardModal.open, #spCardModal.open *,
  #spPayrollReportModal.active, #spPayrollReportModal.active *,
  #spPayrollReportModal.open, #spPayrollReportModal.open * {
    visibility: visible !important;
  }

  #spInvoiceModal.active, #spInvoiceModal.open,
  #spCardModal.active, #spCardModal.open,
  #spPayrollReportModal.active, #spPayrollReportModal.open {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }

  .sp-modal-content {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  .sp-modal-header, .sp-no-print {
    display: none !important;
    visibility: hidden !important;
  }
}
