/* Mobile-First Custom Styles for Merchman */

/* Theme Colors */
:root {
    /* Light mode - Slate theme */
    --tblr-primary: #64748b;
    --tblr-primary-rgb: 100, 116, 139;
    --tblr-primary-fg: #ffffff;
}

[data-bs-theme="light"].theme-slate {
    --tblr-primary: #64748b;
    --tblr-primary-rgb: 100, 116, 139;
    --tblr-bg-surface: #f8fafc;
    --tblr-bg-surface-secondary: #f1f5f9;
    --tblr-border-color: #e2e8f0;
}

[data-bs-theme="dark"].theme-zinc {
    --tblr-primary: #71717a;
    --tblr-primary-rgb: 113, 113, 122;
    --tblr-bg-surface: #18181b;
    --tblr-bg-surface-secondary: #27272a;
    --tblr-bg-surface-tertiary: #3f3f46;
    --tblr-border-color: #3f3f46;
    --tblr-body-bg: #09090b;
    --tblr-body-color: #fafafa;
}

/* Theme toggle button styling */
#theme-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    transition: transform 0.2s;
}

#theme-toggle:hover {
    transform: scale(1.1);
}

#theme-toggle i {
    font-size: 1.25rem;
}

/* Touch Targets - Minimum 44x44px */
.btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 1.5rem;
}

.btn-lg {
    min-height: 56px;
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Mobile-optimized forms */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    font-size: 16px; /* Prevent iOS zoom */
    min-height: 44px;
    padding: 0.75rem;
}

/* Mobile navigation */
.navbar-brand-text {
    font-size: 1.25rem;
    font-weight: 600;
}

@media (max-width: 767px) {
    .navbar-brand-text {
        font-size: 1rem;
    }
    
    .nav-link {
        padding: 1rem;
        font-size: 1.125rem;
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

/* Clock-in/out buttons - Extra large for mobile */
.clock-button {
    min-height: 80px;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.clock-button:active {
    transform: scale(0.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.clock-button i {
    font-size: 2rem;
}

@media (max-width: 767px) {
    .clock-button {
        width: 100%;
        margin-bottom: 1rem;
    }
}

/* Card spacing for mobile */
@media (max-width: 767px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1.125rem;
    }
}

/* Status badges - Larger on mobile */
.badge {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}

@media (max-width: 767px) {
    .badge {
        padding: 0.625rem 1rem;
        font-size: 1rem;
    }
}

/* List items - Touch-friendly */
.list-group-item {
    padding: 1rem;
    min-height: 56px;
}

@media (max-width: 767px) {
    .list-group-item {
        padding: 1.25rem;
    }
}

/* Tables - Responsive cards on mobile */
@media (max-width: 767px) {
    .table-responsive-cards .table {
        border: 0;
    }
    
    .table-responsive-cards .table thead {
        display: none;
    }
    
    .table-responsive-cards .table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e6e7e9;
        border-radius: 0.5rem;
        background-color: #fff;
    }
    
    .table-responsive-cards .table td {
        display: flex;
        justify-content: space-between;
        padding: 0.75rem;
        border: 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .table-responsive-cards .table td:last-child {
        border-bottom: 0;
    }
    
    .table-responsive-cards .table td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 1rem;
    }
}

/* Payment amount - Prominent display */
.payment-amount {
    font-size: 2rem;
    font-weight: 700;
    color: #0054a6;
}

@media (max-width: 767px) {
    .payment-amount {
        font-size: 2.5rem;
    }
}

/* Event cards */
.event-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #0054a6;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* Offline indicator */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #f59f00;
    color: #fff;
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    z-index: 9999;
    display: none;
}

.offline-banner.show {
    display: block;
}

/* Cached content badge */
.cached-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #206bc4;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 9998;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.cached-badge.fade-out {
    opacity: 0;
}

.cached-badge i {
    font-size: 1rem;
}

/* Bottom action bar for mobile */
.bottom-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    border-top: 1px solid #e6e7e9;
    padding: 0.75rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
}

@media (max-width: 767px) {
    .bottom-action-bar {
        display: flex;
        gap: 0.5rem;
    }
    
    .bottom-action-bar .btn {
        flex: 1;
    }
    
    /* Add padding to page body to prevent content from being hidden */
    .page-body {
        padding-bottom: 80px;
    }
}

/* Sticky header on mobile */
@media (max-width: 767px) {
    .sticky-top {
        position: sticky;
        top: 0;
        z-index: 1020;
        background-color: #fff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
}

/* Avatar improvements */
.avatar {
    border-radius: 50%;
}

.avatar-sm {
    width: 40px;
    height: 40px;
}

/* Improved spacing */
.container-xl {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (max-width: 767px) {
    .container-xl {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Quick action buttons on dashboard */
.quick-action {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1.5rem;
    text-align: center;
    border: 2px solid #e6e7e9;
    border-radius: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    min-height: 120px;
}

.quick-action:hover {
    background-color: #f8f9fa;
    border-color: #0054a6;
    transform: translateY(-2px);
}

.quick-action i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #0054a6;
}

.quick-action-title {
    font-weight: 600;
    font-size: 1.125rem;
}

@media (max-width: 767px) {
    .quick-action {
        min-height: 100px;
        padding: 1.25rem;
    }
}

/* Accessible focus states */
*:focus-visible {
    outline: 2px solid #0054a6;
    outline-offset: 2px;
}

/* High contrast for readability */
body {
    color: #1e293b;
    line-height: 1.6;
}

/* Empty states */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #64748b;
}

.empty-state i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #475569;
}

.empty-state-text {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* Offline and Sync Indicators */
#offline-indicator {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

#pending-sync-badge {
    cursor: pointer;
    transition: transform 0.2s;
}

#pending-sync-badge:hover {
    transform: scale(1.05);
}

.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Offline action indicator on buttons */
.queued-offline {
    position: relative;
}

.queued-offline::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: #f59f00;
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

/* Sync status modal */
.sync-status-item {
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.sync-status-item:last-child {
    border-bottom: none;
}

.sync-status-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 0.75rem;
}

.sync-status-icon.pending {
    background: #fef3c7;
    color: #f59f00;
}

.sync-status-icon.syncing {
    background: #dbeafe;
    color: #3b82f6;
}

.sync-status-icon.synced {
    background: #d1fae5;
    color: #10b981;
}

.sync-status-icon.failed {
    background: #fee2e2;
    color: #ef4444;
}
