/**
 * iShopSync — UI polish: typography, forms, tables, auth, livewire, micro-interactions.
 */

/* ---- Typography rhythm ---- */
body.app-authenticated .app-main {
    font-feature-settings: "kern" 1, "liga" 1;
}

.corp-page > .card + .card,
.corp-page .card.mb-4 + .card {
    margin-top: 0;
}

/* ---- Focus accessibility ---- */
:focus-visible {
    outline: 2px solid var(--corp-accent);
    outline-offset: 2px;
}

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--corp-accent-soft) !important;
}

/* ---- Livewire loading ---- */
[wire\:loading],
[wire\:loading\.delay] {
    opacity: 0.65;
    pointer-events: none;
}

/* ---- Pagination ---- */
.pagination {
    gap: 0.25rem;
}

.pagination .page-link {
    border-radius: var(--corp-radius);
    border-color: var(--corp-border);
    color: var(--corp-text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 2.25rem;
    text-align: center;
}

.pagination .page-item.active .page-link {
    background: var(--corp-primary);
    border-color: var(--corp-primary);
    color: #fff;
}

.pagination .page-link:hover {
    background: var(--corp-bg);
    color: var(--corp-primary);
    border-color: var(--corp-border);
}

/* ---- Badges ---- */
.badge {
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 6px;
}

/* ---- Auth pages ---- */
.guest-marketing-page {
    min-height: calc(100dvh - 12rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    padding: 1.5rem 0;
    width: 100%;
}

.guest-marketing-page > .row {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.guest-marketing-page .auth-card,
.guest-marketing-page .corp-auth-card {
    border: 1px solid var(--corp-border-light);
    border-radius: var(--corp-radius-lg);
    box-shadow: var(--corp-shadow-md);
}

.guest-marketing-page .divider::before {
    background: var(--corp-border-light);
}

.guest-marketing-page .divider-text {
    background: var(--corp-surface);
    color: var(--corp-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.auth-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--corp-radius);
    background: var(--corp-primary);
    color: #fff;
    font-size: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.btn-auth-primary {
    background: var(--corp-primary);
    border: 1px solid var(--corp-primary);
    color: #fff;
    font-weight: 600;
    border-radius: var(--corp-radius);
    padding: 0.65rem 1rem;
    transition: background 0.15s ease;
}

.btn-auth-primary:hover {
    background: var(--corp-primary-hover);
    border-color: var(--corp-primary-hover);
    color: #fff;
}

.btn-google {
    border-radius: var(--corp-radius);
    border: 1px solid var(--corp-border);
    font-weight: 500;
}

/* ---- Session chat ---- */
.chat-message,
.session-chat-message {
    border-radius: var(--corp-radius-lg);
}

.chat-message--own,
.message-bubble-own {
    background: var(--corp-primary) !important;
    color: #fff !important;
}

.chat-message--other,
.message-bubble-other {
    background: var(--corp-bg) !important;
    border: 1px solid var(--corp-border-light) !important;
    color: var(--corp-text) !important;
}

/* ---- Notifications ---- */
.notification-item,
.notif-item {
    border-bottom: 1px solid var(--corp-border-light);
    padding: 0.85rem 1rem;
    transition: background 0.15s ease;
}

.notification-item:hover,
.notif-item:hover {
    background: var(--corp-bg);
}

.notification-item.unread {
    background: rgba(30, 58, 95, 0.04);
    border-left: 3px solid var(--corp-accent);
}

/* ---- Support tickets ---- */
.support-ticket-card {
    border: 1px solid var(--corp-border-light);
    border-radius: var(--corp-radius-lg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.support-ticket-card:hover {
    border-color: var(--corp-accent);
    box-shadow: var(--corp-shadow-md);
}

/* ---- Admin page wrappers ---- */
body.admin-surface .admin-users-page-header,
body.admin-surface .admin-tickets {
    margin-bottom: 1rem;
}

body.admin-surface .corp-page {
    animation: corpFadeIn 0.25s ease;
}

/* ---- Form sections ---- */
.corp-form-section {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--corp-border-light);
}

.corp-form-section:last-child {
    border-bottom: none;
}

.corp-form-section__title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--corp-text);
    margin-bottom: 0.75rem;
}

/* ---- Data tables in cards ---- */
.card .table thead th {
    background: var(--corp-bg);
    border-bottom: 2px solid var(--corp-border-light);
    padding: 0.65rem 1rem;
}

.card .table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

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

/* ---- Modals corporate ---- */
.modal-header {
    border-bottom: 1px solid var(--corp-border-light);
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--corp-border-light);
    padding: 0.85rem 1.25rem;
    background: var(--corp-bg);
}

.modal-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--corp-text);
}

/* ---- Skeleton / loading states ---- */
.skeleton-loader,
.skeleton {
    background: linear-gradient(90deg, var(--corp-bg) 25%, var(--corp-border-light) 50%, var(--corp-bg) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.2s ease-in-out infinite;
    border-radius: var(--corp-radius);
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Scrollbar subtle ---- */
.app-sidebar::-webkit-scrollbar,
.app-main::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar::-webkit-scrollbar-thumb,
.app-main::-webkit-scrollbar-thumb {
    background: var(--corp-border);
    border-radius: 3px;
}

/* ---- Dark mode polish ---- */
[data-bs-theme="dark"] .guest-marketing-page .divider-text {
    background: var(--corp-surface);
}

[data-bs-theme="dark"] .notification-item.unread {
    background: rgba(59, 130, 246, 0.08);
}

[data-bs-theme="dark"] .modal-footer {
    background: var(--corp-bg);
}

/* ---- Reduced motion ---- */
.btn-google {
    background: var(--corp-surface);
    color: var(--corp-text);
    border: 1px solid var(--corp-border);
    border-radius: var(--corp-radius);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-google:hover {
    background: var(--corp-bg);
    border-color: var(--corp-primary);
    box-shadow: var(--corp-shadow);
    color: var(--corp-text);
    text-decoration: none;
}

.google-logo {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

[data-bs-theme="dark"] .btn-google {
    background: var(--corp-surface);
    color: var(--corp-text);
    border-color: var(--corp-border);
}

.guest-marketing-page .link-success {
    color: var(--corp-accent) !important;
}

.guest-marketing-page .form-control-lg {
    font-size: 0.95rem;
    border-radius: var(--corp-radius);
}

/* ---- Enhanced cards & depth ---- */
body.app-authenticated:not(.admin-surface) .app-main .card {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.app-sidebar:not(.app-sidebar--admin) .app-sidebar__link.active {
    box-shadow: inset 3px 0 0 var(--corp-accent);
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-loader,
    .skeleton {
        animation: none;
    }
}
