/* Custom styles for OpenCulet Client */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* ===== MODERN MOBILE NAVIGATION ===== */

/* Animated Hamburger Menu */
.hamburger-menu {
    width: 24px;
    height: 24px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hamburger-menu span {
    display: block;
    position: absolute;
    height: 2px;
    width: 100%;
    background: currentColor;
    border-radius: 1px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: all 0.25s ease-in-out;
}

.hamburger-menu span:nth-child(1) {
    top: 4px;
}

.hamburger-menu span:nth-child(2),
.hamburger-menu span:nth-child(3) {
    top: 11px;
}

.hamburger-menu span:nth-child(4) {
    top: 18px;
}

/* Hamburger to X animation */
.hamburger-menu.active span:nth-child(1) {
    top: 11px;
    width: 0%;
    left: 50%;
}

.hamburger-menu.active span:nth-child(2) {
    transform: rotate(45deg);
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg);
}

.hamburger-menu.active span:nth-child(4) {
    top: 11px;
    width: 0%;
    left: 50%;
}

/* Mobile Sidebar Animations */
@media (max-width: 1023px) {
    .mobile-sidebar {
        display: block !important; /* Override Tailwind's hidden class on mobile */
    }
}

.mobile-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

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

/* Backdrop with smooth fade */
.sidebar-backdrop {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Touch-friendly navigation items */
.nav-item-mobile {
    min-height: 56px;
    padding: 16px 20px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.nav-item-mobile::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.nav-item-mobile:active::before {
    left: 100%;
}

/* Ripple effect for touch */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}


/* Loading spinner */
.spinner {
    border: 2px solid #f3f4f6;
    border-top: 2px solid #111827;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile menu animation */
.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Custom focus styles */
*:focus {
    outline: none;
}

/* Enhanced Mobile Responsive Design */
@media (max-width: 1023px) {
    /* Mobile sidebar positioning */
    .mobile-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 50;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
}

/* Desktop sidebar should always be visible */
@media (min-width: 1024px) {
    .mobile-sidebar {
        position: relative !important;
        transform: none !important;
        z-index: auto !important;
        box-shadow: none !important;
    }
}

    /* Touch-optimized navigation */
    .nav-item-mobile {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nav-item-mobile:last-child {
        border-bottom: none;
    }

    /* Larger touch targets for mobile */
    .nav-item-mobile svg {
        width: 24px;
        height: 24px;
    }

    /* Mobile header adjustments */
    .lg\\:hidden {
        display: block !important;
    }

    /* Smooth transitions for mobile interactions */
    * {
        -webkit-tap-highlight-color: transparent;
    }
}

@media (max-width: 640px) {
    /* Extra small mobile devices */
    .mobile-sidebar {
        width: 280px;
    }

    .nav-item-mobile {
        padding: 20px 24px;
        font-size: 16px;
    }

    /* Adjust header spacing */
    .px-6 {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 480px) {
    /* Very small screens */
    .mobile-sidebar {
        width: 100vw;
    }

    .nav-item-mobile {
        padding: 18px 20px;
    }
}

/* Improved scroll behavior for mobile */
@media (max-width: 1024px) {
    .mobile-sidebar .overflow-y-auto {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .mobile-sidebar .overflow-y-auto::-webkit-scrollbar {
        display: none;
    }
}

/* Form input transitions */
input:focus,
textarea:focus,
select:focus {
    transition: all 0.2s ease;
}

/* Button loading state */
.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ===== VOICE USERS LIST STYLES ===== */

.voice-user-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.voice-user-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #111827;
}

.user-email {
    color: #6b7280;
    font-size: 0.75rem;
}

.active-indicator {
    color: #22c55e;
    font-size: 0.625rem;
    animation: pulse 2s infinite;
    line-height: 1;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.user-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-available .status-dot {
    background-color: #22c55e;
}

.status-offline .status-dot {
    background-color: #9ca3af;
}

.status-available {
    color: #22c55e;
}

.status-offline {
    color: #9ca3af;
}

.user-devices {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.device-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    font-size: 0.75rem;
}

.device-name {
    flex: 1;
    color: #374151;
    font-weight: 500;
}

.device-status {
    color: #6b7280;
}

.device-last-seen {
    color: #9ca3af;
    font-size: 0.625rem;
    white-space: nowrap;
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
    .user-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .device-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.75rem 0;
        border-bottom: 1px solid #f3f4f6;
    }

    .device-item:last-child {
        border-bottom: none;
    }
}

/* ===== USER MANAGEMENT MOBILE STYLES ===== */

/* Make user management table scrollable on tablets */
@media (max-width: 1024px) {
    .user-management .bg-white.rounded-lg {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .user-management table {
        min-width: 600px;
    }
}

/* Mobile: Convert table to card-based layout */
@media (max-width: 768px) {
    /* Hide the table on mobile */
    .user-management table {
        display: none;
    }

    /* Show the mobile card list */
    .user-management .mobile-user-list {
        display: block !important;
    }

    /* Card container */
    .mobile-user-card {
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 0.75rem;
        transition: all 0.2s ease;
    }

    .mobile-user-card:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .mobile-user-card:last-child {
        margin-bottom: 0;
    }

    /* User header with avatar and info */
    .mobile-user-header {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .mobile-user-avatar {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: #e5e7eb;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        font-size: 1rem;
        color: #374151;
        flex-shrink: 0;
    }

    .mobile-user-info {
        flex: 1;
        min-width: 0;
    }

    .mobile-user-name {
        font-weight: 600;
        color: #111827;
        font-size: 0.9375rem;
        margin-bottom: 0.125rem;
    }

    .mobile-user-email {
        color: #6b7280;
        font-size: 0.8125rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Badges row */
    .mobile-user-meta {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        margin-bottom: 0.75rem;
    }

    .mobile-user-badge {
        display: inline-flex;
        align-items: center;
        padding: 0.25rem 0.625rem;
        border-radius: 9999px;
        font-size: 0.75rem;
        font-weight: 500;
    }

    .mobile-user-badge.role {
        background-color: #f3f4f6;
        color: #374151;
    }

    .mobile-user-badge.status-active {
        background-color: #dcfce7;
        color: #166534;
    }

    .mobile-user-badge.status-inactive {
        background-color: #fee2e2;
        color: #991b1b;
    }

    /* Actions row */
    .mobile-user-actions {
        display: flex;
        gap: 0.5rem;
        padding-top: 0.75rem;
        border-top: 1px solid #f3f4f6;
    }

    .mobile-user-action-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.375rem;
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
        font-weight: 500;
        border-radius: 8px;
        transition: all 0.2s;
        border: 1px solid #e5e7eb;
        background: white;
        color: #374151;
    }

    .mobile-user-action-btn:hover {
        background: #f9fafb;
    }

    .mobile-user-action-btn.danger {
        color: #dc2626;
        border-color: #fecaca;
    }

    .mobile-user-action-btn.danger:hover {
        background: #fef2f2;
    }

    .mobile-user-action-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Settings panel adjustments for mobile */
    .user-management .mb-6 h3 {
        font-size: 1.125rem;
    }

    .user-management .mb-6 p {
        font-size: 0.8125rem;
    }

    /* Add user button mobile styling */
    .user-management #addUserBtn {
        width: 100%;
        justify-content: center;
    }
}

/* Desktop: hide mobile layout */
@media (min-width: 769px) {
    .user-management .mobile-user-list {
        display: none !important;
    }
}

/* ===== MEMO TEMPLATE PREVIEW ===== */

/* Preview container */
#memoPreviewContainer {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
}

#memoPreviewContainer iframe {
    background: white;
}

/* Loading overlay with blur */
#memoPreviewLoading {
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Error state styling */
#memoPreviewError {
    background: #fef2f2;
}

/* ===== SELECTED METAFIELDS LIST (Sortable) ===== */

/* Selected metafield item styling */
.selected-metafield-item {
    transition: all 0.15s ease;
}

/* Ghost element during drag */
.selected-metafield-item.sortable-ghost {
    opacity: 0.4;
    background: #dbeafe !important;
}

/* Chosen/picked element */
.selected-metafield-item.sortable-chosen {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background: #eff6ff !important;
}

/* Drag handle cursor states */
.selected-metafield-item .drag-handle {
    cursor: grab;
}

.selected-metafield-item .drag-handle:active {
    cursor: grabbing;
}

/* Remove button hover state */
.selected-metafield-item .remove-metafield:hover {
    background: #fef2f2;
    border-radius: 4px;
}

/* === Section Card Sortable Styles (v2.1) === */
.section-card {
    transition: all 0.15s ease;
}

.section-card.sortable-ghost {
    opacity: 0.4;
    background: #dbeafe !important;
}

.section-card.sortable-chosen {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background: #eff6ff !important;
}

.section-drag-handle {
    cursor: grab;
}

.section-drag-handle:active {
    cursor: grabbing;
}

/* ===== PRODUCT LIST ENHANCEMENTS ===== */

/* Status tabs styling */
.status-tab {
    white-space: nowrap;
    transition: all 0.2s ease;
}

.status-tab:hover {
    background-color: #f9fafb;
}

/* Sort dropdown styling */
#sortDropdown {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Product table enhancements */
.product-table-row {
    transition: background-color 0.15s ease;
}

.product-table-row:hover {
    background-color: #f9fafb;
}

/* Status badges in table */
.status-badge {
    transition: all 0.2s ease;
}

/* Responsive table adjustments for new columns */
@media (max-width: 768px) {
    /* Stack status and category info in mobile view */
    .product-status-mobile,
    .product-category-mobile {
        display: inline-flex;
        margin-left: 0.5rem;
    }
}

/* Active filter summary styling */
#productCount button {
    transition: color 0.2s ease;
}

#productCount button:hover {
    text-decoration: underline;
}
/* ===== SKU SETTINGS STYLES ===== */

.strategy-config {
    margin-top: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
}

.pattern-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-family: monospace;
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pattern-chip:hover {
    background: #d1d5db;
    border-color: #9ca3af;
}

.sku-preview-panel {
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.preview-examples {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-sku {
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    font-family: monospace;
    font-size: 0.875rem;
    color: #1f2937;
}

.category-prefix-table {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
}

.category-prefix-table table {
    width: 100%;
    font-size: 0.875rem;
}

.category-prefix-table thead {
    background: #f9fafb;
    position: sticky;
    top: 0;
}

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

/* Form input sizing for inline use */
.form-input-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.form-select-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

