/* ===============================
   HeS-BE-STRUCT-2025 - Global Styles
   Layout dark profesional
   Dominant: #1b2431
   =============================== */

/* Reset & base
   ---------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #070b11;
    color: #e5e7eb;
    line-height: 1.5;
}

/* Scrollbar dark */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #0b1018;
}
::-webkit-scrollbar-thumb {
    background: #1f2933;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #2c3a4c;
}

/* Typography
   ---------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: #f9fafb;
    margin-bottom: 0.5rem;
}

h1 { font-size: 1.875rem; }
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-bottom: 0.75rem;
    color: #d1d5db;
}

span {
    color: inherit;
}

small {
    font-size: 0.8125rem;
    color: #9ca3af;
}

/* Links */
a {
    color: #60a5fa;
    text-decoration: none;
}
a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* Layout helpers
   ---------------------------- */
.page {
    min-height: 100vh;
    background: radial-gradient(circle at top, #1b2431 0, #070b11 55%);
    color: #e5e7eb;
}

.page-inner {
    display: flex;
    min-height: 100vh;
}

/* Sidebar + header skeleton (optional) */
.sidebar {
    width: 240px;
    background: #0f1722;
    border-right: 1px solid #111827;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    padding: 0 1.5rem 1rem;
    font-weight: 700;
    color: #f9fafb;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    list-style: none;
}
.sidebar-nav li {
    margin: 0.25rem 0;
}
.sidebar-nav a {
    display: block;
    padding: 0.5rem 1.5rem;
    color: #9ca3af;
    font-size: 0.9375rem;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    background: #111827;
    color: #e5e7eb;
}
.sidebar-nav a.is-active {
    background: #111827;
    color: #f9fafb;
    border-left-color: #3b82f6;
}

/* Topbar */
.topbar {
    height: 56px;
    background: #0b1018;
    border-bottom: 1px solid #111827;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 500;
    color: #e5e7eb;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Main content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.main-inner {
    padding: 1.5rem;
}

/* Grid & flex utilities
   ---------------------------- */
.flex {
    display: flex;
}
.flex-column {
    flex-direction: column;
}
.flex-center {
    align-items: center;
    justify-content: center;
}
.flex-between {
    justify-content: space-between;
}
.flex-wrap {
    flex-wrap: wrap;
}
.items-center {
    align-items: center;
}

.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 0.75rem; }
.gap-lg { gap: 1rem; }

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

/* Spacing utilities */
.mt-xs { margin-top: 0.25rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 0.75rem; }
.mt-lg { margin-top: 1rem; }
.mt-xl { margin-top: 1.5rem; }

.mb-xs { margin-bottom: 0.25rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 0.75rem; }
.mb-lg { margin-bottom: 1rem; }
.mb-xl { margin-bottom: 1.5rem; }

.pt-sm { padding-top: 0.5rem; }
.pt-md { padding-top: 0.75rem; }
.pt-lg { padding-top: 1rem; }

.pb-sm { padding-bottom: 0.5rem; }
.pb-md { padding-bottom: 0.75rem; }
.pb-lg { padding-bottom: 1rem; }

/* Width helpers */
.w-100 { width: 100%; }
.max-w-sm { max-width: 480px; }
.max-w-md { max-width: 720px; }
.max-w-lg { max-width: 1024px; }
.text-center { text-align: center; }

/* Cards & panels
   ---------------------------- */
.card,
.panel {
    background: #0f1722;
    border-radius: 0.75rem;
    border: 1px solid #111827;
    padding: 1rem 1.25rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.card-header,
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.card-title,
.panel-title {
    font-size: 1rem;
    font-weight: 500;
    color: #f9fafb;
}

.card-subtitle {
    font-size: 0.875rem;
    color: #9ca3af;
}

.card-body,
.panel-body {
    font-size: 0.9375rem;
}

.card-footer,
.panel-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #111827;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Tables
   ---------------------------- */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background: #111827;
}

thead th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-weight: 500;
    color: #9ca3af;
    border-bottom: 1px solid #1f2933;
}

tbody tr:nth-child(even) {
    background: #0b1018;
}

tbody tr:nth-child(odd) {
    background: #070b11;
}

tbody tr:hover {
    background: #101827;
}

tbody td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #111827;
}

/* Forms
   ---------------------------- */
form {
    width: 100%;
}

label {
    display: inline-block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: #d1d5db;
}

.form-group {
    margin-bottom: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    border: 1px solid #1f2933;
    background: #020617;
    color: #e5e7eb;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input::placeholder,
textarea::placeholder {
    color: #6b7280;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5);
    background: #020617;
}

/* Disabled inputs */
input[disabled],
select[disabled],
textarea[disabled],
input:disabled,
select:disabled,
textarea:disabled {
    background: #020617;
    border-color: #111827;
    color: #6b7280;
    cursor: not-allowed;
}

/* Checkbox & radio */
input[type="checkbox"],
input[type="radio"] {
    accent-color: #3b82f6; /* works on modern browsers */
}

/* For custom inline controls */
.form-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Textarea */
textarea {
    resize: vertical;
    min-height: 90px;
}

/* Input with icon (e.g., eye for password) */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    padding-right: 2.25rem;
}

.input-icon {
    position: absolute;
    right: 0.5rem;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.input-icon:hover {
    color: #e5e7eb;
}

/* Buttons
   ---------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: #1f2933;
    color: #e5e7eb;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
}

.btn:hover {
    background: #273445;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.45);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Variants */
.btn-primary {
    background: #2563eb;
    border-color: #1d4ed8;
}
.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #374151;
    border-color: #4b5563;
}

.btn-danger {
    background: #b91c1c;
    border-color: #991b1b;
}
.btn-danger:hover {
    background: #991b1b;
}

.btn-ghost {
    background: transparent;
    border-color: #374151;
}
.btn-ghost:hover {
    background: #111827;
}

/* Icon button */
.btn-icon {
    border-radius: 999px;
    padding: 0.35rem;
    width: 32px;
    height: 32px;
}

/* Full width button */
.btn-block {
    width: 100%;
}

/* Badges / Pills */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary {
    background: rgba(37, 99, 235, 0.15);
    color: #93c5fd;
}
.badge-success {
    background: rgba(34, 197, 94, 0.12);
    color: #6ee7b7;
}
.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
}
.badge-muted {
    background: #111827;
    color: #9ca3af;
}

/* Status dot (ex: active/inactive) */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #6b7280;
}
.status-dot--green {
    background: #22c55e;
}
.status-dot--red {
    background: #ef4444;
}
.status-dot--amber {
    background: #f59e0b;
}

/* Alerts
   ---------------------------- */
.alert {
    border-radius: 0.75rem;
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    border: 1px solid transparent;
}

.alert-info {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.4);
    color: #bfdbfe;
}
.alert-success {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(22, 163, 74, 0.4);
    color: #bbf7d0;
}
.alert-warning {
    background: rgba(217, 119, 6, 0.12);
    border-color: rgba(217, 119, 6, 0.5);
    color: #fed7aa;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fecaca;
}

/* Cards for login / auth
   ---------------------------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    background: #0b1018;
    border-radius: 1rem;
    border: 1px solid #111827;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    padding: 1.75rem 1.75rem 1.5rem;
    width: 100%;
    max-width: 420px;
}

/* Modal
   ---------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    display: none;
    z-index: 999;
}

.modal-backdrop.is-visible {
    display: block;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.is-visible {
    display: flex;
}

.modal-dialog {
    background: #0b1018;
    border-radius: 0.875rem;
    border: 1px solid #111827;
    padding: 1rem 1.25rem;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.modal-title {
    font-size: 1rem;
    font-weight: 500;
    color: #f9fafb;
}

.modal-close {
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.1rem;
}
.modal-close:hover {
    color: #e5e7eb;
}

.modal-body {
    font-size: 0.9375rem;
    color: #d1d5db;
    margin-bottom: 0.75rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Tooltips (simple) */
[data-tooltip] {
    position: relative;
}
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    white-space: nowrap;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: #e5e7eb;
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #1f2933;
    z-index: 50;
}

/* Chips / tags */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid #374151;
    color: #d1d5db;
}

/* Code / pre */
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.8rem;
    background: #020617;
    padding: 0.15rem 0.35rem;
    border-radius: 0.375rem;
    border: 1px solid #111827;
}
pre {
    background: #020617;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #111827;
    overflow-x: auto;
}

/* Forms: error state */
.form-error {
    font-size: 0.8rem;
    color: #fecaca;
    margin-top: 0.25rem;
}
.input-error {
    border-color: #f87171 !important;
}

/* Tables: small helper for compact rows */
.table-compact td,
.table-compact th {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

/* Responsive tweaks
   ---------------------------- */
@media (max-width: 960px) {
    .sidebar {
        display: none;
    }
    .main-inner {
        padding: 1rem;
    }
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: minmax(0, 1fr);
    }
    .topbar {
        padding: 0 1rem;
    }
}
.btn-sm {
    padding: 0.25rem 0.55rem;
    font-size: 0.8rem;
}
