/* =========================================================
   SUNLINE MARKET ERP
   UI COMPONENTS
   ========================================================= */


/* ---------------------------------------------------------
   1. SIDEBAR
   --------------------------------------------------------- */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;

    width: var(--sidebar-width);

    display: flex;
    flex-direction: column;

    background: #ffffff;
    border-right: 1px solid var(--color-border);

    z-index: var(--z-sidebar);

    transition:
        width var(--transition-normal),
        transform var(--transition-normal);
}

.sidebar__header {
    height: var(--navbar-height);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 18px;

    border-bottom: 1px solid var(--color-border-light);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 11px;

    min-width: 0;
}

.sidebar__brand-mark {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    border-radius: 10px;

    background: var(--brand-primary);
    color: #ffffff;

    font-size: 18px;
    font-weight: 800;

    box-shadow: 0 5px 14px rgba(15, 118, 110, 0.20);
}

.sidebar__brand-text {
    display: flex;
    flex-direction: column;

    min-width: 0;
}

.sidebar__brand-text strong {
    color: var(--color-text);

    font-size: 15px;
    font-weight: 750;

    line-height: 1.2;
}

.sidebar__brand-text small {
    margin-top: 2px;

    color: var(--color-text-muted);

    font-size: 10px;
    font-weight: 600;

    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar__close {
    display: none;

    width: 34px;
    height: 34px;

    align-items: center;
    justify-content: center;

    border-radius: 8px;

    color: var(--color-text-secondary);

    cursor: pointer;

    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.sidebar__close:hover {
    background: var(--color-surface-soft);
    color: var(--color-text);
}

.sidebar__nav {
    flex: 1;

    padding: 22px 12px;

    overflow-y: auto;
}

.sidebar__section-title {
    display: block;

    padding: 0 12px 10px;

    color: var(--color-text-muted);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 0.10em;
}

.sidebar__menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar__link {
    position: relative;

    display: flex;
    align-items: center;
    gap: 12px;

    min-height: 44px;

    padding: 10px 12px;

    border-radius: 10px;

    color: var(--color-text-secondary);

    font-size: 13px;
    font-weight: 550;

    transition:
        background var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

.sidebar__link:hover {
    background: #f1f5f9;
    color: var(--color-text);
}

.sidebar__link:active {
    transform: scale(0.985);
}

.sidebar__link.is-active {
    background: rgba(15, 118, 110, 0.09);
    color: var(--brand-primary-dark);
    font-weight: 650;
}

.sidebar__link.is-active::before {
    content: "";

    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;

    width: 3px;

    border-radius: 0 4px 4px 0;

    background: var(--brand-primary);
}

.sidebar__icon {
    position: relative;

    width: 20px;
    height: 20px;

    flex: 0 0 20px;

    color: currentColor;
}

.sidebar__icon::before {
    content: "";

    position: absolute;

    inset: 3px;

    border: 1.6px solid currentColor;
    border-radius: 5px;

    opacity: 0.9;
}

.sidebar__icon--dashboard::after {
    content: "";

    position: absolute;

    width: 5px;
    height: 5px;

    left: 4px;
    top: 4px;

    border-radius: 1px;

    background: currentColor;

    box-shadow:
        7px 0 0 currentColor,
        0 7px 0 currentColor,
        7px 7px 0 currentColor;
}

.sidebar__icon--box::before {
    border-radius: 3px;
}

.sidebar__icon--stock::before {
    border-radius: 3px;
}

.sidebar__icon--warehouse::before {
    border-radius: 2px;
}

.sidebar__icon--users::before {
    border-radius: 50%;
}

.sidebar__icon--reports::before {
    border-radius: 3px;
}

.sidebar__icon--settings::before {
    border-radius: 50%;
}

.sidebar__label {
    min-width: 0;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__footer {
    padding: 16px;

    border-top: 1px solid var(--color-border-light);
}

.sidebar__version {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    color: var(--color-text-muted);

    font-size: 10px;
}

.sidebar__version small {
    font-weight: 600;
}


/* ---------------------------------------------------------
   2. SIDEBAR OVERLAY
   --------------------------------------------------------- */

.sidebar-overlay {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(15, 23, 42, 0.42);

    z-index: var(--z-overlay);

    opacity: 0;
    pointer-events: none;

    transition: opacity var(--transition-normal);
}

.sidebar-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}


/* ---------------------------------------------------------
   3. NAVBAR
   --------------------------------------------------------- */

.navbar {
    position: fixed;
    top: 0;
    right: 0;

    left: var(--sidebar-width);

    height: var(--navbar-height);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 28px;

    background: rgba(255, 255, 255, 0.96);

    border-bottom: 1px solid var(--color-border);

    z-index: var(--z-navbar);

    transition:
        left var(--transition-normal);
}

.navbar__left,
.navbar__right {
    display: flex;
    align-items: center;
}

.navbar__left {
    min-width: 0;
}

.navbar__right {
    gap: 10px;
}

.navbar__menu-toggle {
    display: none;

    width: 40px;
    height: 40px;

    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;

    margin-right: 10px;

    border-radius: 9px;

    cursor: pointer;

    transition: background var(--transition-fast);
}

.navbar__menu-toggle:hover {
    background: var(--color-surface-soft);
}

.navbar__menu-toggle span {
    width: 18px;
    height: 2px;

    border-radius: 2px;

    background: var(--color-text);
}

.navbar__page-info {
    min-width: 0;
}

.navbar__title {
    margin: 0;

    color: var(--color-text);

    font-size: 17px;
    font-weight: 700;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar__icon-button {
    position: relative;

    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    color: var(--color-text-secondary);

    cursor: pointer;

    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.navbar__icon-button:hover {
    background: var(--color-surface-soft);
    color: var(--color-text);
}

.navbar__notification-icon {
    position: relative;

    width: 18px;
    height: 18px;

    border: 1.6px solid currentColor;
    border-radius: 9px 9px 6px 6px;
}

.navbar__notification-icon::after {
    content: "";

    position: absolute;

    left: 50%;
    bottom: -4px;

    width: 6px;
    height: 2px;

    transform: translateX(-50%);

    border-radius: 3px;

    background: currentColor;
}

.navbar__notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;

    min-width: 15px;
    height: 15px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 4px;

    border: 2px solid #ffffff;
    border-radius: 999px;

    background: var(--color-danger);
    color: #ffffff;

    font-size: 8px;
    font-weight: 700;
}

.navbar__user {
    position: relative;
}

.navbar__user-button {
    display: flex;
    align-items: center;
    gap: 9px;

    padding: 5px 8px 5px 5px;

    border-radius: 11px;

    cursor: pointer;

    transition: background var(--transition-fast);
}

.navbar__user-button:hover {
    background: var(--color-surface-soft);
}

.navbar__avatar {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 36px;

    border-radius: 50%;

    background: var(--brand-primary-light);
    color: var(--brand-primary-dark);

    font-size: 13px;
    font-weight: 750;
}

.navbar__user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    min-width: 0;
}

.navbar__user-name {
    max-width: 150px;

    color: var(--color-text);

    font-size: 12px;
    font-weight: 650;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar__user-role {
    margin-top: 1px;

    color: var(--color-text-muted);

    font-size: 10px;
}

.navbar__user-arrow {
    width: 7px;
    height: 7px;

    margin-left: 2px;

    border-right: 1.5px solid var(--color-text-secondary);
    border-bottom: 1.5px solid var(--color-text-secondary);

    transform: rotate(45deg) translateY(-2px);
}


/* ---------------------------------------------------------
   4. USER DROPDOWN
   --------------------------------------------------------- */

.navbar__user-menu {
    position: absolute;

    top: calc(100% + 10px);
    right: 0;

    width: 210px;

    padding: 7px;

    background: #ffffff;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow-lg);

    z-index: var(--z-dropdown);

    animation: dropdownIn 160ms ease;
}

.navbar__user-menu[hidden],
.notification-panel[hidden] {
    display: none;
}

.navbar__user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px 11px;

    border-radius: 8px;

    color: var(--color-text-secondary);

    font-size: 12px;
    font-weight: 550;

    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.navbar__user-menu-item:hover {
    background: var(--color-surface-soft);
    color: var(--color-text);
}

.navbar__user-menu-item--danger {
    color: var(--color-danger);
}

.navbar__user-menu-divider {
    height: 1px;

    margin: 6px 4px;

    background: var(--color-border-light);
}

.navbar__menu-icon {
    width: 17px;
    height: 17px;

    border: 1.5px solid currentColor;
    border-radius: 4px;
}


/* ---------------------------------------------------------
   5. NOTIFICATION PANEL
   --------------------------------------------------------- */

.notification-panel {
    position: fixed;

    top: calc(var(--navbar-height) + 10px);
    right: 24px;

    width: 350px;
    max-width: calc(100vw - 32px);

    background: #ffffff;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);

    z-index: var(--z-dropdown);

    overflow: hidden;

    animation: dropdownIn 160ms ease;
}

.notification-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    padding: 17px 18px;

    border-bottom: 1px solid var(--color-border-light);
}

.notification-panel__header h2 {
    margin: 0;

    color: var(--color-text);

    font-size: 14px;
    font-weight: 700;
}

.notification-panel__header span {
    display: block;

    margin-top: 2px;

    color: var(--color-text-muted);

    font-size: 10px;
}

.notification-panel__close {
    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 8px;

    color: var(--color-text-secondary);

    font-size: 20px;
    line-height: 1;

    cursor: pointer;
}

.notification-panel__close:hover {
    background: var(--color-surface-soft);
}

.notification-panel__body {
    max-height: 380px;

    overflow-y: auto;
}

.notification-empty {
    min-height: 220px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    padding: 30px;

    text-align: center;
}

.notification-empty__icon {
    width: 42px;
    height: 42px;

    margin-bottom: 14px;

    border: 1px solid var(--color-border);
    border-radius: 50%;

    background: var(--color-surface-soft);
}

.notification-empty strong {
    color: var(--color-text);

    font-size: 12px;
}

.notification-empty span:last-child {
    max-width: 230px;

    margin-top: 5px;

    color: var(--color-text-muted);

    font-size: 10px;
    line-height: 1.5;
}


/* ---------------------------------------------------------
   6. CARDS
   --------------------------------------------------------- */

.card {
    background: var(--color-surface);

    border: 1px solid var(--color-border);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-xs);

    overflow: hidden;

    transition:
        box-shadow var(--transition-normal),
        border-color var(--transition-normal),
        transform var(--transition-normal);
}

.card:hover {
    border-color: #d8e0ea;
    box-shadow: var(--shadow-sm);
}

.card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 16px;

    padding: 20px 22px;

    border-bottom: 1px solid var(--color-border-light);
}

.card__title {
    margin: 0;

    color: var(--color-text);

    font-size: 14px;
    font-weight: 700;
}

.card__description {
    margin: 4px 0 0;

    color: var(--color-text-muted);

    font-size: 11px;
}

.card__body {
    padding: 22px;
}

.card__footer {
    padding: 14px 22px;

    border-top: 1px solid var(--color-border-light);

    background: var(--color-surface-soft);
}


/* ---------------------------------------------------------
   7. STAT CARDS
   --------------------------------------------------------- */

.stats-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 16px;
}

.stat-card {
    position: relative;

    padding: 20px;

    background: #ffffff;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-xs);

    overflow: hidden;

    transition:
        transform var(--transition-normal),
        box-shadow var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;
}

.stat-card__label {
    color: var(--color-text-secondary);

    font-size: 11px;
    font-weight: 600;
}

.stat-card__icon {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: var(--brand-primary-light);
    color: var(--brand-primary-dark);
}

.stat-card__value {
    margin-top: 13px;

    color: var(--color-text);

    font-size: 26px;
    font-weight: 750;

    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-card__meta {
    display: flex;
    align-items: center;
    gap: 7px;

    margin-top: 10px;

    color: var(--color-text-muted);

    font-size: 10px;
}

.stat-card__trend {
    font-weight: 700;
}

.stat-card__trend--up {
    color: var(--color-success);
}

.stat-card__trend--down {
    color: var(--color-danger);
}


/* ---------------------------------------------------------
   8. BUTTONS
   --------------------------------------------------------- */

.btn {
    min-height: 38px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 8px 14px;

    border: 1px solid transparent;
    border-radius: 9px;

    font-size: 12px;
    font-weight: 650;

    cursor: pointer;

    transition:
        background var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn--primary {
    background: var(--brand-primary);
    color: #ffffff;

    box-shadow: 0 3px 8px rgba(15, 118, 110, 0.18);
}

.btn--primary:hover {
    background: var(--brand-primary-dark);
    box-shadow: 0 5px 12px rgba(15, 118, 110, 0.22);
}

.btn--secondary {
    background: #ffffff;

    border-color: var(--color-border);

    color: var(--color-text-secondary);
}

.btn--secondary:hover {
    background: var(--color-surface-soft);
    color: var(--color-text);
}

.btn--danger {
    background: var(--color-danger);
    color: #ffffff;
}

.btn--danger:hover {
    background: #b91c1c;
}

.btn--success {
    background: var(--color-success);
    color: #ffffff;
}

.btn--success:hover {
    background: #15803d;
}

.btn--ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn--ghost:hover {
    background: var(--color-surface-soft);
    color: var(--color-text);
}

.btn--sm {
    min-height: 32px;

    padding: 6px 10px;

    font-size: 11px;
}

.btn--lg,
.btn--large {
    min-height: 44px;

    padding: 10px 18px;

    font-size: 13px;
}

.btn--icon {
    width: 38px;
    min-width: 38px;

    padding: 0;
}

.btn--icon.btn--sm {
    width: 32px;
    min-width: 32px;
}

.btn__spinner {
    width: 15px;
    height: 15px;

    display: inline-block;

    border: 2px solid rgba(255, 255, 255, 0.38);
    border-top-color: currentColor;

    border-radius: 50%;

    animation: buttonSpinner 650ms linear infinite;
}


/* ---------------------------------------------------------
   9. FORMS
   --------------------------------------------------------- */

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;

    margin-bottom: 7px;

    color: var(--color-text);

    font-size: 11px;
    font-weight: 650;
}

.form-label .required {
    color: var(--color-danger);
}

.form-control,
.form-select,
.form-textarea {
    width: 100%;

    min-height: 40px;

    padding: 9px 12px;

    background: #ffffff;

    border: 1px solid var(--color-border);
    border-radius: 9px;

    color: var(--color-text);

    font-size: 12px;

    outline: none;

    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.form-control::placeholder,
.form-textarea::placeholder {
    color: #a8b2c1;
}

.form-control:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: #cbd5e1;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--brand-primary);

    box-shadow:
        0 0 0 3px rgba(15, 118, 110, 0.10);
}

.form-textarea {
    min-height: 100px;

    resize: vertical;
}

.form-help {
    display: block;

    margin-top: 5px;

    color: var(--color-text-muted);

    font-size: 10px;
}

.form-error {
    display: block;

    margin-top: 5px;

    color: var(--color-danger);

    font-size: 10px;
}

.form-control.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
    border-color: var(--color-danger);
}

.form-control.is-valid,
.form-select.is-valid,
.form-textarea.is-valid {
    border-color: var(--color-success);
}

.form-row {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 16px;
}


/* ---------------------------------------------------------
   10. TABLES
   --------------------------------------------------------- */

.table-wrapper {
    width: 100%;

    overflow-x: auto;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);

    background: #ffffff;
}

.data-table {
    width: 100%;

    border-collapse: collapse;

    min-width: 720px;
}

.data-table th {
    padding: 12px 16px;

    background: #f8fafc;

    border-bottom: 1px solid var(--color-border);

    color: var(--color-text-secondary);

    font-size: 10px;
    font-weight: 700;

    text-align: left;
    text-transform: uppercase;

    letter-spacing: 0.04em;

    white-space: nowrap;
}

.data-table td {
    padding: 13px 16px;

    border-bottom: 1px solid var(--color-border-light);

    color: var(--color-text-secondary);

    font-size: 11px;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: #fafcfd;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table td strong {
    color: var(--color-text);

    font-weight: 650;
}


/* ---------------------------------------------------------
   11. BADGES
   --------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 24px;

    padding: 4px 8px;

    border-radius: 999px;

    font-size: 9px;
    font-weight: 700;

    white-space: nowrap;
}

.badge--success {
    background: var(--color-success-bg);
    color: #15803d;
}

.badge--warning {
    background: var(--color-warning-bg);
    color: #b45309;
}

.badge--danger {
    background: var(--color-danger-bg);
    color: #b91c1c;
}

.badge--info {
    background: var(--color-info-bg);
    color: #1d4ed8;
}

.badge--neutral {
    background: #f1f5f9;
    color: var(--color-text-secondary);
}


/* ---------------------------------------------------------
   12. ALERTS
   --------------------------------------------------------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    padding: 12px 14px;

    border: 1px solid transparent;
    border-radius: 10px;

    font-size: 11px;
}

.alert strong {
    display: block;

    margin-bottom: 2px;

    font-weight: 700;
}

.alert--success {
    background: var(--color-success-bg);
    border-color: #bbf7d0;
    color: #166534;
}

.alert--warning {
    background: var(--color-warning-bg);
    border-color: #fde68a;
    color: #92400e;
}

.alert--danger {
    background: var(--color-danger-bg);
    border-color: #fecaca;
    color: #991b1b;
}

.alert--info {
    background: var(--color-info-bg);
    border-color: #bfdbfe;
    color: #1e40af;
}


/* ---------------------------------------------------------
   13. DROPDOWN
   --------------------------------------------------------- */

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;

    top: calc(100% + 8px);
    right: 0;

    min-width: 190px;

    padding: 6px;

    background: #ffffff;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow-lg);

    z-index: var(--z-dropdown);

    animation: dropdownIn 160ms ease;
}

.dropdown-menu[hidden] {
    display: none;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;

    width: 100%;

    padding: 9px 10px;

    border-radius: 8px;

    color: var(--color-text-secondary);

    font-size: 11px;

    cursor: pointer;

    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--color-surface-soft);
    color: var(--color-text);
}


/* ---------------------------------------------------------
   14. EMPTY STATE
   --------------------------------------------------------- */

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    min-height: 260px;

    padding: 30px;

    text-align: center;
}

.empty-state__icon {
    width: 50px;
    height: 50px;

    margin-bottom: 15px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    background: var(--color-surface-soft);
    color: var(--color-text-muted);
}

.empty-state__title {
    margin: 0;

    color: var(--color-text);

    font-size: 14px;
    font-weight: 700;
}

.empty-state__description {
    max-width: 400px;

    margin: 6px 0 16px;

    color: var(--color-text-muted);

    font-size: 11px;
    line-height: 1.6;
}


/* ---------------------------------------------------------
   15. MODAL
   --------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(15, 23, 42, 0.48);

    z-index: var(--z-modal);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity var(--transition-normal),
        visibility var(--transition-normal);
}

.modal.is-open {
    opacity: 1;
    visibility: visible;
}

.modal__dialog {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 48px);

    display: flex;
    flex-direction: column;

    background: #ffffff;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);

    transform: translateY(10px) scale(0.985);

    transition:
        transform var(--transition-normal);
}

.modal.is-open .modal__dialog {
    transform: translateY(0) scale(1);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    padding: 18px 20px;

    border-bottom: 1px solid var(--color-border-light);
}

.modal__title {
    margin: 0;

    color: var(--color-text);

    font-size: 14px;
    font-weight: 700;
}

.modal__close {
    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 8px;

    color: var(--color-text-secondary);

    font-size: 19px;

    cursor: pointer;
}

.modal__close:hover {
    background: var(--color-surface-soft);
}

.modal__body {
    padding: 20px;

    overflow-y: auto;
}

.modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;

    padding: 14px 20px;

    border-top: 1px solid var(--color-border-light);
}


/* ---------------------------------------------------------
   16. TOAST
   --------------------------------------------------------- */

.toast-container {
    position: fixed;

    right: 20px;
    bottom: 20px;

    width: min(380px, calc(100vw - 32px));

    display: flex;
    flex-direction: column;
    gap: 10px;

    z-index: var(--z-toast);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 11px;

    padding: 13px 14px;

    background: #ffffff;

    border: 1px solid var(--color-border);
    border-radius: 11px;

    box-shadow: var(--shadow-lg);

    animation: toastIn 220ms ease;
}

.toast__content {
    flex: 1;
    min-width: 0;
}

.toast__title {
    margin: 0;

    color: var(--color-text);

    font-size: 11px;
    font-weight: 700;
}

.toast__message {
    margin: 3px 0 0;

    color: var(--color-text-secondary);

    font-size: 10px;
    line-height: 1.5;
}

.toast__close {
    width: 24px;
    height: 24px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--color-text-muted);

    border-radius: 6px;

    cursor: pointer;
}

.toast__close:hover {
    background: var(--color-surface-soft);
}


/* ---------------------------------------------------------
   17. APP FOOTER
   --------------------------------------------------------- */

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin-left: var(--sidebar-width);

    padding: 18px 32px;

    border-top: 1px solid var(--color-border-light);

    color: var(--color-text-muted);

    font-size: 10px;

    background: var(--color-bg);

    transition:
        margin-left var(--transition-normal);
}

.app-footer__left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-footer__separator {
    color: #cbd5e1;
}


/* ---------------------------------------------------------
   18. LOGIN PAGE
   --------------------------------------------------------- */

.login-page {
    min-height: 100vh;

    margin: 0;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #f5f7fa;

    overflow-x: hidden;
}

.login-page__background {
    position: fixed;
    inset: 0;

    overflow: hidden;

    pointer-events: none;
}

.login-page__shape {
    position: absolute;

    border-radius: 50%;

    opacity: 0.65;
}

.login-page__shape--one {
    width: 420px;
    height: 420px;

    top: -210px;
    right: -140px;

    background: rgba(15, 118, 110, 0.07);
}

.login-page__shape--two {
    width: 360px;
    height: 360px;

    bottom: -210px;
    left: -140px;

    background: rgba(37, 99, 235, 0.045);
}

.login-container {
    position: relative;
    z-index: 1;

    width: 100%;

    display: flex;
    justify-content: center;

    padding: 32px 20px;
}

.login-card {
    width: 100%;
    max-width: 430px;

    padding: 34px 36px 24px;

    background: rgba(255, 255, 255, 0.98);

    border: 1px solid var(--color-border);
    border-radius: 20px;

    box-shadow:
        0 20px 55px rgba(15, 23, 42, 0.09);

    animation: loginCardIn 360ms ease both;
}

.login-card__header {
    margin-bottom: 28px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 11px;

    margin-bottom: 30px;
}

.login-brand__mark {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 11px;

    background: var(--brand-primary);
    color: #ffffff;

    font-size: 20px;
    font-weight: 800;

    box-shadow:
        0 6px 16px rgba(15, 118, 110, 0.18);
}

.login-brand__text {
    display: flex;
    flex-direction: column;
}

.login-brand__text strong {
    color: var(--color-text);

    font-size: 16px;
    font-weight: 750;

    line-height: 1.15;
}

.login-brand__text span {
    margin-top: 3px;

    color: var(--color-text-muted);

    font-size: 10px;
    font-weight: 600;

    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.login-card__intro h1 {
    margin: 0;

    color: var(--color-text);

    font-size: 25px;
    font-weight: 750;

    line-height: 1.2;
    letter-spacing: -0.025em;
}

.login-card__intro p {
    margin: 8px 0 0;

    color: var(--color-text-secondary);

    font-size: 12px;
    line-height: 1.6;
}

.login-card > .alert {
    margin-bottom: 18px;
}

.login-form {
    width: 100%;
}

.login-form .form-group {
    margin-bottom: 17px;
}

.login-form .form-label {
    font-size: 11px;
}

.login-form .form-control {
    min-height: 44px;

    padding: 10px 13px;

    font-size: 13px;
}

.login-form__password {
    position: relative;
}

.login-form__password .form-control {
    padding-right: 46px;
}

.login-form__password-toggle {
    position: absolute;

    top: 50%;
    right: 12px;

    width: 26px;
    height: 26px;

    display: flex;
    align-items: center;
    justify-content: center;

    transform: translateY(-50%);

    border-radius: 6px;

    color: var(--color-text-muted);

    cursor: pointer;

    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.login-form__password-toggle:hover {
    background: var(--color-surface-soft);
    color: var(--color-text-secondary);
}

.login-form__password-toggle span {
    position: relative;

    width: 16px;
    height: 11px;

    display: block;

    border: 1.5px solid currentColor;
    border-radius: 10px / 7px;
}

.login-form__password-toggle span::after {
    content: "";

    position: absolute;

    top: 50%;
    left: 50%;

    width: 4px;
    height: 4px;

    transform: translate(-50%, -50%);

    border-radius: 50%;

    background: currentColor;
}

.login-form__password-toggle[aria-pressed="true"] span {
    opacity: 0.45;
}

.login-form__password-toggle[aria-pressed="true"] span::before {
    content: "";

    position: absolute;

    left: -3px;
    top: 4px;

    width: 21px;
    height: 1.5px;

    transform: rotate(-35deg);

    background: currentColor;
}

.login-form__options {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin: 2px 0 20px;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    color: var(--color-text-secondary);

    font-size: 11px;

    cursor: pointer;
}

.checkbox input {
    width: 15px;
    height: 15px;

    margin: 0;

    accent-color: var(--brand-primary);

    cursor: pointer;
}

.login-form__submit {
    width: 100%;

    min-height: 46px;

    border-radius: 10px;
}

.login-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-top: 24px;
    padding-top: 17px;

    border-top: 1px solid var(--color-border-light);

    color: var(--color-text-muted);

    font-size: 9px;
}

.login-card__footer span:last-child {
    text-align: right;
}


/* ---------------------------------------------------------
   19. ANIMATIONS
   --------------------------------------------------------- */

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loginCardIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes buttonSpinner {
    to {
        transform: rotate(360deg);
    }
}


/* ---------------------------------------------------------
   20. PAGE ANIMATION
   --------------------------------------------------------- */

.page-enter {
    animation: slideUp 260ms ease both;
}


/* ---------------------------------------------------------
   21. LOADING SKELETON
   --------------------------------------------------------- */

.skeleton {
    position: relative;

    overflow: hidden;

    background: #e9eef4;

    border-radius: 7px;
}

.skeleton::after {
    content: "";

    position: absolute;
    inset: 0;

    transform: translateX(-100%);

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.55),
            transparent
        );

    animation: skeletonLoading 1.4s infinite;
}

@keyframes skeletonLoading {
    100% {
        transform: translateX(100%);
    }
}


/* ---------------------------------------------------------
   22. RESPONSIVE LOGIN
   --------------------------------------------------------- */

@media (max-width: 576px) {

    .login-container {
        padding: 20px 14px;
    }

    .login-card {
        max-width: none;

        padding: 28px 22px 21px;

        border-radius: 16px;
    }

    .login-card__header {
        margin-bottom: 24px;
    }

    .login-brand {
        margin-bottom: 24px;
    }

    .login-card__intro h1 {
        font-size: 22px;
    }

    .login-card__intro p {
        font-size: 11px;
    }

    .login-card__footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-card__footer span:last-child {
        text-align: left;
    }

    .login-page__shape--one {
        width: 280px;
        height: 280px;

        top: -150px;
        right: -120px;
    }

    .login-page__shape--two {
        width: 260px;
        height: 260px;

        bottom: -160px;
        left: -120px;
    }

}


/* ---------------------------------------------------------
   23. VERY SMALL MOBILE
   --------------------------------------------------------- */

@media (max-width: 380px) {

    .login-container {
        padding: 14px 10px;
    }

    .login-card {
        padding: 24px 18px 18px;
    }

    .login-card__intro h1 {
        font-size: 20px;
    }

    .login-brand__mark {
        width: 38px;
        height: 38px;

        font-size: 18px;
    }

}


/* ---------------------------------------------------------
   24. REDUCED MOTION
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    .login-card {
        animation: none;
    }

    .btn__spinner {
        animation-duration: 1.5s;
    }

}