/* =========================================================
   HERLEAX BMS — SHARED COMPONENTS
   ========================================================= */

/* =========================================================
   CARDS
   ========================================================= */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
}


/* =========================================================
   GRID
   ========================================================= */

.grid {
    display: grid;
    gap: 20px;
}

.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));
}


/* =========================================================
   STAT CARDS
   ========================================================= */

.stat-card {
    padding: 20px;
}

.stat-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stat-card__label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.stat-card__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--primary);
    background: var(--primary-light);
    font-size: 17px;
    font-weight: 700;
}

.stat-card__value {
    margin-top: 15px;
    font-size: 25px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card__meta {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 11px;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background var(--transition),
        border-color var(--transition),
        color var(--transition),
        transform var(--transition);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    color: #FFFFFF;
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-danger {
    color: #FFFFFF;
    background: var(--danger);
    border-color: var(--danger);
}

.btn-sm {
    min-height: 34px;
    padding: 6px 11px;
    font-size: 12px;
}

.btn-lg {
    min-height: 46px;
    padding: 11px 19px;
}


/* =========================================================
   FORMS
   ========================================================= */

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid #CBD5E1;
    border-radius: var(--radius-sm);
    outline: none;
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.form-help {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 11px;
}

.form-error {
    display: block;
    margin-top: 6px;
    color: var(--danger);
    font-size: 11px;
}


/* =========================================================
   TABLES
   ========================================================= */

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.table th {
    color: var(--text-muted);
    background: #F8FAFC;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table td {
    color: #334155;
    font-size: 13px;
}

.table tbody tr:hover {
    background: #F8FAFC;
}


/* =========================================================
   BADGES
   ========================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}

.badge-primary {
    color: var(--primary-dark);
    background: var(--primary-light);
}

.badge-success {
    color: #15803D;
    background: #F0FDF4;
}

.badge-warning {
    color: #B45309;
    background: #FFFBEB;
}

.badge-danger {
    color: #B91C1C;
    background: #FEF2F2;
}


/* =========================================================
   ALERTS
   ========================================================= */

.alert {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 13px;
}

.alert-success {
    color: #166534;
    background: #F0FDF4;
    border-color: #BBF7D0;
}

.alert-warning {
    color: #92400E;
    background: #FFFBEB;
    border-color: #FDE68A;
}

.alert-danger {
    color: #991B1B;
    background: #FEF2F2;
    border-color: #FECACA;
}

.alert-info {
    color: #075985;
    background: #F0F9FF;
    border-color: #BAE6FD;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
    padding: 50px 20px;
    text-align: center;
}

.empty-state__icon {
    margin-bottom: 14px;
    color: var(--text-muted);
    font-size: 34px;
}

.empty-state__title {
    margin-bottom: 7px;
    font-size: 16px;
    font-weight: 700;
}

.empty-state__text {
    max-width: 440px;
    margin: 0 auto 18px;
    color: var(--text-muted);
    font-size: 12px;
}


/* =========================================================
   MODAL
   ========================================================= */

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

.modal.show {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 1;
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
}

.modal-header {
    border-bottom: 1px solid var(--border);
}

.modal-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}

.modal-body {
    padding: 20px;
}

.modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}


/* =========================================================
   QUICK ACTIONS
   ========================================================= */

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}


/* =========================================================
   SUBSCRIPTION
   ========================================================= */

.subscription-card {
    padding: 20px;
    background: linear-gradient(
        135deg,
        var(--primary-light),
        var(--surface)
    );
}

.subscription-card__plan {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.subscription-card__title {
    margin: 5px 0 0;
    font-size: 19px;
    font-weight: 700;
}

.subscription-card__meta {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 12px;
}


/* =========================================================
   AUTH / LOGIN / REGISTER
   ========================================================= */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 35px 20px;
    background: var(--bg);
}

.auth-container {
    width: 100%;
    max-width: 920px;
}

.auth-brand {
    margin-bottom: 22px;
    text-align: center;
}

.auth-brand__name {
    margin: 0;
    color: var(--primary);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.4px;
}

.auth-brand__subtitle {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.auth-card__header {
    padding: 25px 28px 20px;
    border-bottom: 1px solid var(--border);
}

.auth-card__title {
    margin: 0;
    font-size: 21px;
    font-weight: 750;
}

.auth-card__description {
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
}

.auth-card__body {
    padding: 25px 28px;
}

.auth-card__footer {
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-card__footer a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-card__footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}


/* =========================================================
   AUTH SECTIONS
   ========================================================= */

.auth-section {
    margin-bottom: 25px;
}

.auth-section:last-child {
    margin-bottom: 0;
}

.auth-section__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.auth-section__number {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    color: #FFFFFF;
    background: var(--primary);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
}

.auth-section__title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.auth-section__description {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 11px;
}


/* =========================================================
   PLAN SELECTION
   ========================================================= */

.plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.plan-option {
    position: relative;
}

.plan-option__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.plan-card {
    position: relative;
    height: 100%;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        transform var(--transition);
}

.plan-card:hover {
    border-color: #93C5FD;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.plan-option__input:checked + .plan-card {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.plan-option__input:focus-visible + .plan-card {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.plan-card__check {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    border: 1px solid #CBD5E1;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
}

.plan-option__input:checked + .plan-card .plan-card__check {
    color: #FFFFFF;
    background: var(--primary);
    border-color: var(--primary);
}

.plan-card__name {
    margin: 0;
    padding-right: 25px;
    font-size: 16px;
    font-weight: 750;
}

.plan-card__price {
    margin-top: 9px;
    color: var(--primary);
    font-size: 20px;
    font-weight: 800;
}

.plan-card__period {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
}

.plan-card__trial {
    display: inline-flex;
    margin-top: 9px;
    padding: 4px 8px;
    color: #166534;
    background: #F0FDF4;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}

.plan-card__description {
    min-height: 34px;
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.55;
}

.plan-card__features {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.plan-card__feature {
    display: flex;
    gap: 7px;
    margin-top: 7px;
    color: #475569;
    font-size: 11px;
    line-height: 1.4;
}

.plan-card__feature:first-child {
    margin-top: 0;
}

.plan-card__feature-icon {
    color: var(--primary);
    font-weight: 800;
}


/* =========================================================
   AUTH FORM HELPERS
   ========================================================= */

.auth-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
}

.auth-form-grid .form-group {
    min-width: 0;
}

.auth-form-grid .form-group--full {
    grid-column: 1 / -1;
}

.auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 24px;
}

.auth-actions--end {
    justify-content: flex-end;
}

.auth-submit {
    width: 100%;
}

.auth-note {
    margin-top: 12px;
    padding: 11px 13px;
    color: #075985;
    background: #F0F9FF;
    border: 1px solid #BAE6FD;
    border-radius: var(--radius-md);
    font-size: 11px;
    line-height: 1.55;
}

.auth-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}

.auth-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}


/* =========================================================
   RESPONSIVE COMPONENTS
   ========================================================= */

@media (max-width: 800px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .plan-grid {
        grid-template-columns: 1fr;
    }

    .plan-card__description {
        min-height: auto;
    }
}

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

    .auth-page {
        padding: 20px 12px;
    }

    .auth-card__header,
    .auth-card__body,
    .auth-card__footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .auth-form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .auth-form-grid .form-group--full {
        grid-column: auto;
    }

    .auth-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
