/* core/base.css */
/* Base styles and resets */

/* ========================================
   RESET & BASE
   ======================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  font-family: var(--ds-font-family);
}
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--ds-font-family-sans);
  font-size: var(--ds-font-size-m);
  font-weight: var(--ds-font-weight-normal);
  line-height: 1.5;
  color: var(--ds-color-text);
  background-color: var(--ds-color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ========================================
   SCREEN READER ONLY
   ======================================== */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Skip Link */
.c-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--ds-color-accent);
  color: var(--ds-color-text-on-accent);
  padding: var(--ds-space-s) var(--ds-space-m);
  z-index: var(--nav-z-modal);
  text-decoration: none;
  border-radius: 0 0 var(--ds-radius-m) 0;
}

.c-skip-link:focus {
  top: 0;
}

/* Focus Visible */
:focus-visible {
  outline: var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);
  outline-offset: var(--ds-focus-ring-offset);
  border-radius: var(--ds-radius-s);
}

/* Remove focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ========================================
   LAYOUT
   ======================================== */

.l-dashboard {
  display: flex;
  height: 100vh;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.l-dashboard__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  transition: margin-left var(--ds-duration-normal) var(--ds-ease-out);
}

/* Overlay for mobile */
.l-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--nav-z-overlay);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ds-duration-normal) var(--ds-ease-out),
              visibility var(--ds-duration-normal) var(--ds-ease-out);
}

.l-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--ds-space-m) 0;
  font-family: var(--ds-font-family);
  font-weight: var(--ds-font-weight-semibold);
  line-height: 1.2;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1.125rem;
}

h5 {
  font-size: 1rem;
}

h6 {
  font-size: 0.875rem;
}

p {
  margin: 0 0 var(--ds-space-m) 0;
  font-family: var(--ds-font-family);
}

a {
  color: var(--ds-color-accent);
  text-decoration: none;
  transition: color var(--ds-duration-fast) var(--ds-ease-out);
  font-family: var(--ds-font-family);
}

a:hover {
  color: var(--ds-color-accent-hover);
  text-decoration: underline;
}

/* ========================================
   LISTS
   ======================================== */

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ========================================
   BUTTONS
   ======================================== */

button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  color: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.c-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-s);
  padding: var(--ds-space-s) var(--ds-space-m);
  font-size: var(--ds-font-size-m);
  font-weight: var(--ds-font-weight-medium);
  line-height: 1;
  color: var(--ds-color-text);
  background: var(--ds-color-surface);
  border: 1px solid var(--ds-color-border);
  border-radius: var(--ds-radius-m);
  transition: all var(--ds-duration-fast) var(--ds-ease-out);
  white-space: nowrap;
  user-select: none;
}

.c-button:hover:not(:disabled) {
  background: var(--ds-color-surface-hover);
  border-color: var(--ds-color-border-strong);
}

.c-button:active:not(:disabled) {
  transform: translateY(1px);
}

.c-button--primary {
  color: var(--ds-color-text-on-accent);
  background: var(--ds-color-accent);
  border-color: var(--ds-color-accent);
}

.c-button--primary:hover:not(:disabled) {
  background: var(--ds-color-accent-hover);
  border-color: var(--ds-color-accent-hover);
}

.c-button--secondary {
  color: var(--ds-color-accent);
  background: transparent;
  border-color: var(--ds-color-accent);
}

.c-button--secondary:hover:not(:disabled) {
  color: var(--ds-color-text-on-accent);
  background: var(--ds-color-accent);
}

/* ========================================
   FORMS
   ======================================== */

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

legend {
  /* display: block;
  width: 100%; */
  padding: 0;
  margin-bottom: var(--ds-space-s);
  font-size: var(--ds-font-size-m);
  font-weight: var(--ds-font-weight-semibold);
  color: var(--ds-color-text);
}

label {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-s);
  cursor: pointer;
  user-select: none;
}

input[type="radio"],
input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

select {
  appearance: none;
  padding: var(--ds-space-s) var(--ds-space-m);
  padding-right: calc(var(--ds-space-m) * 2.5);
  background: var(--ds-color-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--ds-space-s) center;
  background-size: 20px;
  border: 1px solid var(--ds-color-border);
  border-radius: var(--ds-radius-m);
  color: var(--ds-color-text);
  cursor: pointer;
  transition: all var(--ds-duration-fast) var(--ds-ease-out);
}

select:hover {
  border-color: var(--ds-color-border-strong);
}

select:focus {
  border-color: var(--ds-color-accent);
  outline: none;
}

/* ========================================
   CARDS
   ======================================== */

/* .c-card {
  background: var(--ds-color-surface);
  border: 1px solid var(--ds-color-border);
  border-radius: var(--ds-radius-l);
  box-shadow: var(--ds-shadow-xs);
  overflow: hidden;
}

.c-card__header {
  padding: var(--ds-space-l);
  border-bottom: 1px solid var(--ds-color-border);
}

.c-card__title {
  margin: 0;
  font-size: var(--ds-font-size-l);
  font-weight: var(--ds-font-weight-semibold);
  color: var(--ds-color-text);
}

.c-card__body {
  padding: var(--ds-space-l);
}

.c-card__footer {
  padding: var(--ds-space-l);
  border-top: 1px solid var(--ds-color-border);
  background: var(--ds-color-surface-raised);
} */

/* ========================================
   UTILITIES
   ======================================== */

.u-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.u-text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.u-flex {
  display: flex;
}

.u-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.u-gap-xs {
  gap: var(--ds-space-xs);
}

.u-gap-s {
  gap: var(--ds-space-s);
}

.u-gap-m {
  gap: var(--ds-space-m);
}

.u-gap-l {
  gap: var(--ds-space-l);
}

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

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

::-webkit-scrollbar-track {
  background: var(--ds-color-surface-raised);
  border-radius: var(--ds-radius-m);
}

::-webkit-scrollbar-thumb {
  background: var(--ds-color-border-strong);
  border-radius: var(--ds-radius-m);
  border: 2px solid var(--ds-color-surface-raised);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ds-color-text-weaker);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--ds-color-border-strong) var(--ds-color-surface-raised);
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ========================================
   MEDIA QUERIES
   ======================================== */

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  .l-dashboard {
    position: relative;
  }
}

@media (max-width: 1024px) {
  .c-card__header,
  .c-card__body,
  .c-card__footer {
    padding: var(--ds-space-m);
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  body {
    background: white;
    color: black;
  }
  
  .c-sidebar,
  .c-sidebar-internal,
  .c-sidebar-right,
  .c-topbar,
  .c-settings,
  .l-overlay {
    display: none !important;
  }
  
  .l-dashboard__main {
    margin: 0 !important;
  }
  
  .c-main {
    padding: 0 !important;
  }
}