/* ============================================
   Dashboard Custom Styles
   ============================================ */

/* --------------------------------------------
   FORM COMPONENTS
   -------------------------------------------- */

/* Form input field - used across all forms */
.form-input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #1e293b;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
}

.dark .form-input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(199, 125, 255, 0.2);
    color: #E2E8F0;
}

.form-input:focus {
    border-color: #C77DFF;
    box-shadow: 0 0 0 3px rgba(199, 125, 255, 0.15);
}

.form-input::placeholder {
    color: #6B7280;
}

.form-input:disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

.dark .form-input:disabled {
    color: #6b7280;
}

/* Form field label */
.form-label {
    display: block;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    color: rgb(107 114 128);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dark .form-label {
    color: rgb(148 163 184);
}

/* Form validation error text */
.form-error {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    line-height: 1rem;
    color: rgb(248 113 113);
}

/* --------------------------------------------
   ALERTS & MESSAGES
   -------------------------------------------- */

/* Error alert box */
.alert-error {
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: rgb(254 242 242);
    border: 1px solid rgb(254 202 202);
    color: rgb(185 28 28);
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.dark .alert-error {
    background: rgb(239 68 68 / 0.1);
    border-color: rgb(239 68 68 / 0.3);
    color: rgb(252 165 165);
}

/* --------------------------------------------
   BUTTONS
   -------------------------------------------- */

/* Primary action button (brand purple) */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: rgb(255 255 255);
    background-color: #6B2FA0;
    border: 1px solid rgb(199 125 255 / 0.3);
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.btn-primary:hover {
    background-color: rgb(199 125 255 / 0.8);
}

/* Secondary/cancel button (neutral gray) */
.btn-secondary {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: rgb(107 114 128);
    background-color: rgb(243 244 246);
    border: 1px solid rgb(229 231 235);
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.btn-secondary:hover {
    background-color: rgb(229 231 235);
}

.dark .btn-secondary {
    color: rgb(148 163 184);
    background-color: rgb(255 255 255 / 0.05);
    border-color: rgb(255 255 255 / 0.1);
}

.dark .btn-secondary:hover {
    background-color: rgb(255 255 255 / 0.1);
}

/* Danger/destructive button (red) */
.btn-danger {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: rgb(255 255 255);
    background-color: rgb(220 38 38);
    transition-property: background-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.btn-danger:hover {
    background-color: rgb(239 68 68);
}

/* --------------------------------------------
   LINKS
   -------------------------------------------- */

/* Action links (View →, Edit →) in tables and cards */
.action-link {
    font-size: 0.75rem;
    line-height: 1rem;
    color: rgb(147 51 234);
    transition-property: color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.action-link:hover {
    color: rgb(17 24 39);
}

.dark .action-link {
    color: #C77DFF;
}

.dark .action-link:hover {
    color: #a78bfa;
}

/* Back/navigation links with muted styling */
.link-back {
    color: rgb(156 163 175);
    transition-property: color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.link-back:hover {
    color: rgb(17 24 39);
}

.dark .link-back {
    color: rgb(100 116 139);
}

.dark .link-back:hover {
    color: rgb(255 255 255);
}

/* Add/create links with icon */
.link-add {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    line-height: 1rem;
    color: rgb(147 51 234);
    transition-property: color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.link-add:hover {
    color: rgb(17 24 39);
}

.dark .link-add {
    color: #C77DFF;
}

.dark .link-add:hover {
    color: rgb(255 255 255);
}

/* --------------------------------------------
   CARDS & CONTAINERS
   -------------------------------------------- */

/* Standard card container */
.card {
    background-color: rgb(255 255 255);
    border: 1px solid rgb(229 231 235);
    border-radius: 0.75rem;
}

.dark .card {
    background-color: #150929;
    border-color: rgb(61 26 110 / 0.3);
}

/* Card with overflow hidden (for tables) */
.card-table {
    background-color: rgb(255 255 255);
    border: 1px solid rgb(229 231 235);
    border-radius: 0.75rem;
    overflow: hidden;
}

.dark .card-table {
    background-color: #150929;
    border-color: rgb(61 26 110 / 0.3);
}

/* Danger/error card with red border */
.card-danger {
    background-color: rgb(255 255 255);
    border: 1px solid rgb(254 202 202);
    border-radius: 0.75rem;
}

.dark .card-danger {
    background-color: #150929;
    border-color: rgb(239 68 68 / 0.2);
}

/* --------------------------------------------
   TABLES
   -------------------------------------------- */

/* Table header row */
.table-header {
    font-size: 0.75rem;
    line-height: 1rem;
    color: rgb(156 163 175);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgb(229 231 235);
}

.dark .table-header {
    color: rgb(100 116 139);
    border-bottom-color: rgb(61 26 110 / 0.2);
}

/* Table header cell */
.table-th {
    padding: 0.75rem 1.25rem;
    text-align: left;
    font-weight: 500;
}

/* Table body with dividers between rows */
.table-body {
    border-top: 1px solid rgb(243 244 246);
}

.table-body > * + * {
    border-top: 1px solid rgb(243 244 246);
}

.dark .table-body > * + * {
    border-top-color: rgb(61 26 110 / 0.1);
}

/* Table row with hover effect */
.table-row {
    transition-property: background-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.table-row:hover {
    background-color: rgb(249 250 251);
}

.dark .table-row:hover {
    background-color: rgb(255 255 255 / 0.03);
}

/* Table data cell */
.table-td {
    padding: 0.75rem 1.25rem;
}

/* Table cell text (small, primary) */
.table-cell-text {
    font-size: 0.75rem;
    line-height: 1rem;
    color: rgb(75 85 99);
}

.dark .table-cell-text {
    color: rgb(226 232 240);
}

/* Table cell text (small, muted) */
.table-cell-muted {
    font-size: 0.75rem;
    line-height: 1rem;
    color: rgb(107 114 128);
}

.dark .table-cell-muted {
    color: rgb(148 163 184);
}

/* --------------------------------------------
   TYPOGRAPHY
   -------------------------------------------- */

/* Main page heading */
.page-title {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 600;
    color: rgb(17 24 39);
}

.dark .page-title {
    color: rgb(255 255 255);
}

/* Page subtitle/description */
.page-subtitle {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: rgb(107 114 128);
}

.dark .page-subtitle {
    color: rgb(148 163 184);
}

/* Section heading within a page */
.section-title {
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: rgb(75 85 99);
}

.dark .section-title {
    color: rgb(148 163 184);
}

/* Large heading (for modals, detail pages) */
.heading-lg {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 600;
    color: rgb(17 24 39);
}

.dark .heading-lg {
    color: rgb(255 255 255);
}

/* Context/meta text (breadcrumbs, timestamps) */
.text-meta {
    font-size: 0.75rem;
    line-height: 1rem;
    color: rgb(156 163 175);
}

.dark .text-meta {
    color: rgb(100 116 139);
}

/* --------------------------------------------
   NAVIGATION
   -------------------------------------------- */

/* Base navigation link style */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Active navigation link */
.nav-link-active {
    background-color: rgb(250 245 255);
    color: rgb(147 51 234);
    border: 1px solid rgb(233 213 255);
}

.dark .nav-link-active {
    background-color: rgb(199 125 255 / 0.1);
    color: #C77DFF;
    border-color: rgb(199 125 255 / 0.2);
}

/* Inactive navigation link */
.nav-link-inactive {
    color: rgb(107 114 128);
}

.nav-link-inactive:hover {
    color: rgb(17 24 39);
    background-color: rgb(243 244 246);
}

.dark .nav-link-inactive {
    color: rgb(148 163 184);
}

.dark .nav-link-inactive:hover {
    color: rgb(255 255 255);
    background-color: rgb(255 255 255 / 0.05);
}

/* --------------------------------------------
   PAGINATION
   -------------------------------------------- */

/* Pagination footer container */
.pagination-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgb(229 231 235);
    font-size: 0.75rem;
    line-height: 1rem;
    color: rgb(107 114 128);
}

.dark .pagination-footer {
    border-top-color: rgb(61 26 110 / 0.2);
    color: rgb(148 163 184);
}

/* Pagination button */
.pagination-btn {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    background-color: rgb(243 244 246);
    transition-property: background-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.pagination-btn:hover {
    background-color: rgb(229 231 235);
}

.dark .pagination-btn {
    background-color: rgb(61 26 110 / 0.3);
}

.dark .pagination-btn:hover {
    background-color: rgb(61 26 110 / 0.5);
}

/* Active pagination page */
.pagination-active {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    background-color: rgb(243 232 255);
    color: rgb(147 51 234);
    border: 1px solid rgb(216 180 254);
}

.dark .pagination-active {
    background-color: rgb(199 125 255 / 0.2);
    color: #C77DFF;
    border-color: rgb(199 125 255 / 0.3);
}

/* --------------------------------------------
   BORDERS & DIVIDERS
   -------------------------------------------- */

/* Section divider (border bottom) */
.border-section {
    border-bottom: 1px solid rgb(229 231 235);
}

.dark .border-section {
    border-bottom-color: rgb(61 26 110 / 0.2);
}

/* --------------------------------------------
   UTILITIES
   -------------------------------------------- */

/* Code pane for syntax-highlighted content */
pre.code-pane {
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Failure highlight for error traces */
.failure-highlight {
    display: block;
    background: rgba(239, 68, 68, 0.2);
    border-left: 3px solid #EF4444;
    padding-left: 4px;
}

/* --------------------------------------------
   PYGMENTS SYNTAX HIGHLIGHTING
   -------------------------------------------- */

/* Light mode */
.highlight .nt { color: #6d28d9; }
.highlight .na { color: #0369a1; }
.highlight .s, .highlight .s2 { color: #047857; }
.highlight .mi, .highlight .mf { color: #b45309; }
.highlight .kc { color: #be185d; }
.highlight .p { color: #6b7280; }
.highlight .cp { color: #6b7280; }
.highlight .err { color: #6d28d9; border: none; }

/* Dark mode */
.dark .highlight .nt { color: #c4b5fd; }
.dark .highlight .na { color: #7dd3fc; }
.dark .highlight .s, .dark .highlight .s2 { color: #86efac; }
.dark .highlight .mi, .dark .highlight .mf { color: #fcd34d; }
.dark .highlight .kc { color: #f9a8d4; }
.dark .highlight .p { color: #a1a1aa; }
.dark .highlight .cp { color: #a1a1aa; }
.dark .highlight .err { color: #c4b5fd; border: none; }

/* --------------------------------------------
   TOMSELECT COMPONENT
   -------------------------------------------- */

/* Light mode */
.ts-wrapper, .ts-wrapper.single, .ts-wrapper.single.focus, .ts-wrapper.single.input-active {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
}

.ts-wrapper.focus, .ts-wrapper.single.focus, .ts-wrapper.single.input-active {
    border-color: #C77DFF;
    box-shadow: 0 0 0 3px rgba(199, 125, 255, 0.15);
}

.ts-wrapper .ts-control, .ts-wrapper.single .ts-control, .ts-wrapper.single.input-active .ts-control {
    background: transparent !important;
    border: none;
    color: #1e293b;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.ts-wrapper .ts-control input, .ts-wrapper.single .ts-control input {
    color: #1e293b !important;
}

.ts-wrapper .ts-control input::placeholder {
    color: #6B7280;
}

.ts-wrapper .ts-control .item {
    color: #1e293b;
}

.ts-dropdown, .ts-dropdown.single {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    margin-top: 2px;
}

.ts-dropdown .option {
    color: #1e293b;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.ts-dropdown .option:hover, .ts-dropdown .active {
    background: #f3e8ff;
    color: #6B2FA0;
}

.ts-dropdown .no-results {
    color: #6B7280;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Dark mode */
.dark .ts-wrapper, .dark .ts-wrapper.single, .dark .ts-wrapper.single.focus, .dark .ts-wrapper.single.input-active {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(199, 125, 255, 0.2);
}

.dark .ts-wrapper.focus, .dark .ts-wrapper.single.focus, .dark .ts-wrapper.single.input-active {
    border-color: #C77DFF;
}

.dark .ts-wrapper .ts-control, .dark .ts-wrapper.single .ts-control, .dark .ts-wrapper.single.input-active .ts-control {
    color: #E2E8F0;
}

.dark .ts-wrapper .ts-control input, .dark .ts-wrapper.single .ts-control input {
    color: #E2E8F0 !important;
}

.dark .ts-wrapper .ts-control .item {
    color: #E2E8F0;
}

.dark .ts-dropdown, .dark .ts-dropdown.single {
    background: #150929;
    border-color: rgba(199, 125, 255, 0.3);
}

.dark .ts-dropdown .option {
    color: #E2E8F0;
}

.dark .ts-dropdown .option:hover, .dark .ts-dropdown .active {
    background: rgba(199, 125, 255, 0.15);
    color: #fff;
}
