/**
 * ThikKoro - Global Application Styles
 */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Firefox & Hallmark Typography/Rendering Optimizations */
html {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f8fafc;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

button::-moz-focus-inner,
input::-moz-focus-inner {
  border: 0;
  padding: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

body {
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text-main);
  background-color: var(--color-bg);
  overflow-x: clip;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
}

img, svg {
  display: block;
  max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--color-text-main);
  font-weight: 700;
  line-height: 1.25;
}

p {
  margin-bottom: 1rem;
}

/* =====================================================================
   BUTTONS (PREMIUM COMPONENT SYSTEM)
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.885rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md, 10px);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
  flex-shrink: 0;
  vertical-align: middle;
  transition: transform 180ms ease;
}

.btn:hover svg {
  transform: translateX(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background: linear-gradient(180deg, #1c64f2 0%, #0a56f0 100%);
  color: #ffffff;
  border-color: #0845c4;
  box-shadow: 0 1px 2px 0 rgba(10, 86, 240, 0.2), 0 4px 12px 0 rgba(10, 86, 240, 0.25), inset 0 1px 0 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #256df6 0%, #0845c4 100%);
  color: #ffffff;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 18px 0 rgba(10, 86, 240, 0.35), inset 0 1px 0 0 rgba(255, 255, 255, 0.3);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 1px 3px 0 rgba(10, 86, 240, 0.25);
}

.btn-success {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: #047857;
  box-shadow: 0 1px 2px 0 rgba(16, 185, 129, 0.2), 0 4px 12px 0 rgba(16, 185, 129, 0.22), inset 0 1px 0 0 rgba(255, 255, 255, 0.25);
}
.btn-success:hover:not(:disabled) {
  background: linear-gradient(180deg, #18c58e 0%, #047857 100%);
  color: #ffffff;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 16px 0 rgba(16, 185, 129, 0.32);
}
.btn-success:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.btn-danger {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-color: #b91c1c;
  box-shadow: 0 1px 2px 0 rgba(239, 68, 68, 0.2), 0 4px 12px 0 rgba(239, 68, 68, 0.22), inset 0 1px 0 0 rgba(255, 255, 255, 0.25);
}
.btn-danger:hover:not(:disabled) {
  background: linear-gradient(180deg, #f87171 0%, #b91c1c 100%);
  color: #ffffff;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 16px 0 rgba(239, 68, 68, 0.32);
}
.btn-danger:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.btn-warning {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border-color: #b45309;
  box-shadow: 0 1px 2px 0 rgba(245, 158, 11, 0.2), 0 4px 12px 0 rgba(245, 158, 11, 0.22), inset 0 1px 0 0 rgba(255, 255, 255, 0.25);
}
.btn-warning:hover:not(:disabled) {
  transform: translateY(-1.5px);
  color: #ffffff;
  box-shadow: 0 6px 16px 0 rgba(245, 158, 11, 0.32);
}

.btn-outline {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}
.btn-outline:hover:not(:disabled) {
  background-color: #f8fafc;
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px 0 rgba(10, 86, 240, 0.1);
}
.btn-outline:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-premium {
  background: linear-gradient(135deg, #0a56f0 0%, #4338ca 100%);
  color: #ffffff;
  border: 1px solid #3730a3;
  box-shadow: 0 4px 16px rgba(67, 56, 202, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  font-weight: 700;
}
.btn-premium:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d68ff 0%, #3730a3 100%);
  color: #ffffff;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 22px rgba(67, 56, 202, 0.42);
}

.btn-sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm, 7px);
}

.btn-lg {
  padding: 0.825rem 1.75rem;
  font-size: 1.025rem;
  border-radius: var(--radius-md, 11px);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* =====================================================================
   STATUS BADGES (PREMIUM PILLS)
   ===================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.24rem 0.65rem;
  border-radius: var(--radius-full);
  line-height: 1.25;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

.badge-success {
  background-color: var(--color-success-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background-color: var(--color-warning-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-danger {
  background-color: var(--color-danger-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-info {
  background-color: var(--color-info-light);
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.badge-secondary, .badge-neutral {
  background-color: var(--color-surface-muted);
  color: #475569;
  border: 1px solid var(--color-border);
}

/* =====================================================================
   FORMS & INPUTS
   ===================================================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-text-main);
}

.form-label .required {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.65rem 0.875rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text-main);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(10, 86, 240, 0.15);
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
}

.form-error {
  font-size: 0.8rem;
  color: var(--color-danger);
  margin-top: 0.35rem;
}

/* =====================================================================
   CARDS & CONTAINERS
   ===================================================================== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.5rem;
  background-color: #fff;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  background-color: var(--color-surface-muted);
  border-top: 1px solid var(--color-border);
}

/* =====================================================================
   TABLES
   ===================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

.table th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.825rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  background-color: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-main);
  vertical-align: middle;
}

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

.table tr:hover td {
  background-color: rgba(248, 250, 252, 0.7);
}

/* =====================================================================
   ALERTS
   ===================================================================== */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.925rem;
}

.alert-success {
  background-color: var(--color-success-light);
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.alert-danger {
  background-color: var(--color-danger-light);
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-warning {
  background-color: var(--color-warning-light);
  border: 1px solid #fde68a;
  color: #92400e;
}

.alert-info {
  background-color: var(--color-info-light);
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* =====================================================================
   UTILITY CLASSES
   ===================================================================== */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.flex-column { flex-direction: column; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-bold { font-weight: 700; }
.text-right { text-align: right; }
.text-center { text-align: center; }

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

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