/* ===========================
   XIO QR - BEM Stylesheet
   =========================== */

/* ── Sidebar ── */

.xio-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    width: 16rem;
    height: 100vh;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.xio-sidebar--open {
    transform: translateX(0);
}

@media (min-width: 1024px) {
    .xio-sidebar {
        position: sticky;
        transform: translateX(0);
        flex-shrink: 0;
    }
}

.xio-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.xio-sidebar__logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
}

.xio-sidebar__logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: #4c6ef5;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.xio-sidebar__logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.xio-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 0.75rem;
}

.xio-sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.15s ease;
}

.xio-sidebar__link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.xio-sidebar__link--active {
    background: rgba(76, 110, 245, 0.25);
    color: #fff;
}

/* ── Topbar ── */

.xio-topbar {
    display: flex;
    align-items: center;
    height: 3.5rem;
    padding: 0 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.xio-topbar__menu-btn {
    padding: 0.375rem;
    border-radius: 0.375rem;
    color: #6b7280;
    border: none;
    background: none;
    cursor: pointer;
}

.xio-topbar__menu-btn:hover {
    background: #f3f4f6;
}

.xio-topbar__user {
    position: relative;
}

.xio-topbar__user-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
}

.xio-topbar__user-btn:hover {
    background: #f3f4f6;
}

.xio-topbar__dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    width: 12rem;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    z-index: 50;
}

.xio-topbar__dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
}

.xio-topbar__dropdown-item:hover {
    background: #f3f4f6;
}

/* ── Alert ── */

.xio-alert {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.xio-alert--success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.xio-alert--error {
    background: #fff5f5;
    color: #c92a2a;
    border: 1px solid #ffc9c9;
}

.xio-alert__list {
    margin: 0;
    padding-left: 1.25rem;
    list-style: disc;
}

.xio-alert__list li {
    margin-bottom: 0.125rem;
}

/* ── Dashboard ── */

.xio-dashboard__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1.5rem;
}

.xio-dashboard__subtitle {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.xio-dashboard__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.xio-dashboard__chart-wrap {
    background: #fff;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 1.5rem;
}

.xio-dashboard__chart {
    height: 280px;
}

.xio-dashboard__top-qr {
    background: #fff;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

/* ── Stat Card ── */

.xio-stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    padding: 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

.xio-stat-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.xio-stat-card__icon--blue {
    background: #dbe4ff;
    color: #4c6ef5;
}

.xio-stat-card__icon--gray {
    background: #f3f4f6;
    color: #6b7280;
}

.xio-stat-card__icon--green {
    background: #d3f9d8;
    color: #37b24d;
}

.xio-stat-card__body {
    display: flex;
    flex-direction: column;
}

.xio-stat-card__label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.xio-stat-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

/* ── Page ── */

.xio-page__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.xio-page__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

/* ── Card ── */

.xio-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

.xio-card--sticky {
    position: sticky;
    top: 1.5rem;
}

/* ── Table ── */

.xio-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.xio-table thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.xio-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    white-space: nowrap;
}

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

.xio-table tbody tr:hover {
    background: #f9fafb;
}

.xio-table--compact thead th,
.xio-table--compact tbody td {
    padding: 0.5rem 0.75rem;
}

/* ── Badge ── */

.xio-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.xio-badge--green {
    background: #d3f9d8;
    color: #2b8a3e;
}

.xio-badge--red {
    background: #ffe3e3;
    color: #c92a2a;
}

.xio-badge--blue {
    background: #dbe4ff;
    color: #3b5bdb;
}

/* ── Buttons ── */

.xio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.xio-btn--primary {
    background: #4c6ef5;
    color: #fff;
}

.xio-btn--primary:hover {
    background: #4263eb;
}

.xio-btn--ghost {
    background: transparent;
    color: #374151;
    border-color: #d1d5db;
}

.xio-btn--ghost:hover {
    background: #f3f4f6;
}

.xio-btn--outline {
    background: #fff;
    color: #4c6ef5;
    border-color: #bac8ff;
}

.xio-btn--outline:hover {
    background: #f0f4ff;
}

.xio-btn--success {
    background: #37b24d;
    color: #fff;
}

.xio-btn--success:hover {
    background: #2f9e44;
}

.xio-btn--warning {
    background: #f59f00;
    color: #fff;
}

.xio-btn--warning:hover {
    background: #f08c00;
}

.xio-btn--danger {
    background: transparent;
    color: #e03131;
    border-color: #ffc9c9;
}

.xio-btn--danger:hover {
    background: #fff5f5;
}

.xio-btn--sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.xio-btn--loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.xio-spinner {
    width: 1rem;
    height: 1rem;
    animation: xio-spin 0.8s linear infinite;
}

@keyframes xio-spin {
    to { transform: rotate(360deg); }
}

/* ── Dropdown ── */

.xio-dropdown {
    position: absolute;
    z-index: 50;
    margin-top: 0.25rem;
    min-width: 8rem;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.xio-dropdown--right {
    right: 0;
}

.xio-dropdown__item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: #374151;
    text-decoration: none;
    white-space: nowrap;
}

.xio-dropdown__item:hover {
    background: #f3f4f6;
}

/* ── Form ── */

.xio-form__group {
    margin-bottom: 1rem;
}

.xio-form__label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.xio-form__input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #111827;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.xio-form__input:focus {
    border-color: #4c6ef5;
    box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.15);
}

.xio-form__input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

.xio-form__addon-wrap {
    display: flex;
    align-items: stretch;
}

.xio-form__input--addon {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex: 1;
}

.xio-form__addon {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-left: none;
    border-radius: 0 0.5rem 0.5rem 0;
    font-size: 0.8125rem;
    color: #6b7280;
    white-space: nowrap;
}

.xio-form__color-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.xio-form__color-picker {
    width: 3rem;
    height: 2.25rem;
    padding: 0.125rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    cursor: pointer;
    background: none;
}

.xio-form__color-value {
    font-size: 0.8125rem;
    color: #6b7280;
    font-family: monospace;
}

.xio-form__toggle-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.xio-form__toggle {
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 0.25rem;
    border: 1px solid #d1d5db;
    cursor: pointer;
    accent-color: #4c6ef5;
}

.xio-form__error {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: #e03131;
}

.xio-form__hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* ── QR Preview ── */

.xio-qr-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    min-height: 200px;
    overflow: hidden;
}

.xio-qr-preview--show {
    min-height: 160px;
    padding: 1rem;
}

.xio-qr-preview__img {
    width: 100%;
    max-width: 250px;
}

.xio-qr-preview__img svg {
    width: 100%;
    height: auto;
}

/* ── Login ── */

.xio-login__logo-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.xio-login__logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    background: #4c6ef5;
    border-radius: 0.75rem;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.xio-login__logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.025em;
}

.xio-login__card {
    width: 100%;
    max-width: 24rem;
    background: #fff;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
}

/* ── Empty State ── */

.xio-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
}

/* ── Utilities ── */

@media (max-width: 640px) {
    .xio-page__header {
        flex-direction: column;
        align-items: flex-start;
    }
}
