/**
 * ============================================
 * Customer-Facing Design System
 * Modern UI/UX Enhancement for Customer Views
 * ============================================
 */

/* ========== CSS Variables ========== */
:root {
    /* Primary Colors */
    --customer-primary: #6777ef;
    --customer-primary-dark: #4c63d2;
    --customer-primary-light: #8c99f3;
    --customer-primary-gradient: linear-gradient(135deg, #6777ef 0%, #4c63d2 100%);

    /* Secondary Colors */
    --customer-success: #28a745;
    --customer-success-light: #d4edda;
    --customer-info: #17a2b8;
    --customer-info-light: #d1ecf1;
    --customer-warning: #ffc107;
    --customer-warning-light: #fff3cd;
    --customer-danger: #dc3545;
    --customer-danger-light: #f8d7da;

    /* Neutral Colors */
    --customer-white: #ffffff;
    --customer-gray-50: #f9fafb;
    --customer-gray-100: #f3f4f6;
    --customer-gray-200: #e5e7eb;
    --customer-gray-300: #d1d5db;
    --customer-gray-400: #9ca3af;
    --customer-gray-500: #6b7280;
    --customer-gray-600: #4b5563;
    --customer-gray-700: #374151;
    --customer-gray-800: #1f2937;
    --customer-gray-900: #111827;

    /* Text Colors */
    --customer-text-primary: #1f2937;
    --customer-text-secondary: #6b7280;
    --customer-text-muted: #9ca3af;

    /* Border & Shadow */
    --customer-border-color: #e5e7eb;
    --customer-border-radius: 12px;
    --customer-border-radius-sm: 8px;
    --customer-border-radius-lg: 16px;

    --customer-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --customer-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --customer-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --customer-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --customer-shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Spacing */
    --customer-spacing-xs: 0.25rem;
    --customer-spacing-sm: 0.5rem;
    --customer-spacing-md: 1rem;
    --customer-spacing-lg: 1.5rem;
    --customer-spacing-xl: 2rem;
    --customer-spacing-2xl: 3rem;

    /* Transitions */
    --customer-transition: all 0.3s ease;
    --customer-transition-fast: all 0.15s ease;
    --customer-transition-slow: all 0.5s ease;
}

/* ========== Global Enhancements ========== */
.customer-view-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--customer-text-primary);
    line-height: 1.6;
}

/* ========== Modern Card Styles ========== */
.modern-card {
    background: var(--customer-white);
    border-radius: var(--customer-border-radius);
    box-shadow: var(--customer-shadow);
    padding: var(--customer-spacing-xl);
    transition: var(--customer-transition);
    border: 1px solid var(--customer-border-color);
}

.modern-card:hover {
    box-shadow: var(--customer-shadow-md);
    transform: translateY(-2px);
}

.modern-card-header {
    margin-bottom: var(--customer-spacing-lg);
    padding-bottom: var(--customer-spacing-md);
    border-bottom: 2px solid var(--customer-gray-100);
}

.modern-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--customer-text-primary);
    margin-bottom: var(--customer-spacing-sm);
}

.modern-card-subtitle {
    font-size: 0.95rem;
    color: var(--customer-text-secondary);
    margin: 0;
}

/* ========== Enhanced Form Styles ========== */
.modern-form-group {
    margin-bottom: var(--customer-spacing-lg);
}

.modern-label {
    display: block;
    font-weight: 600;
    color: var(--customer-text-primary);
    margin-bottom: var(--customer-spacing-sm);
    font-size: 0.95rem;
}

.modern-input,
.modern-select,
.modern-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--customer-gray-200);
    border-radius: var(--customer-border-radius-sm);
    transition: var(--customer-transition-fast);
    background: var(--customer-white);
    color: var(--customer-text-primary);
}

.modern-input:focus,
.modern-select:focus,
.modern-textarea:focus {
    outline: none;
    border-color: var(--customer-primary);
    box-shadow: 0 0 0 3px rgba(103, 119, 239, 0.1);
}

.modern-input::placeholder {
    color: var(--customer-text-muted);
}

.modern-input.is-invalid {
    border-color: var(--customer-danger);
}

.modern-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.modern-input-icon {
    position: relative;
}

.modern-input-icon input {
    padding-left: 2.75rem;
}

.modern-input-icon .icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--customer-text-muted);
}

/* ========== Modern Buttons ========== */
.modern-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--customer-border-radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--customer-transition-fast);
    text-decoration: none;
    line-height: 1.5;
}

.modern-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--customer-shadow-md);
}

.modern-btn:active {
    transform: translateY(0);
}

.modern-btn-primary {
    background: var(--customer-primary-gradient);
    color: var(--customer-white);
}

.modern-btn-primary:hover {
    background: linear-gradient(135deg, #4c63d2 0%, #3a4fb8 100%);
    color: var(--customer-white);
}

.modern-btn-outline {
    background: transparent;
    border: 2px solid var(--customer-primary);
    color: var(--customer-primary);
}

.modern-btn-outline:hover {
    background: var(--customer-primary);
    color: var(--customer-white);
}

.modern-btn-success {
    background: var(--customer-success);
    color: var(--customer-white);
}

.modern-btn-danger {
    background: var(--customer-danger);
    color: var(--customer-white);
}

.modern-btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.modern-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.modern-btn-block {
    width: 100%;
}

.modern-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== Alert/Message Styles ========== */
.modern-alert {
    padding: 1rem 1.25rem;
    border-radius: var(--customer-border-radius-sm);
    margin-bottom: var(--customer-spacing-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.modern-alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.modern-alert-success {
    background: var(--customer-success-light);
    color: #155724;
    border-left: 4px solid var(--customer-success);
}

.modern-alert-info {
    background: var(--customer-info-light);
    color: #0c5460;
    border-left: 4px solid var(--customer-info);
}

.modern-alert-warning {
    background: var(--customer-warning-light);
    color: #856404;
    border-left: 4px solid var(--customer-warning);
}

.modern-alert-danger {
    background: var(--customer-danger-light);
    color: #721c24;
    border-left: 4px solid var(--customer-danger);
}

/* ========== Badge Styles ========== */
.modern-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 9999px;
    line-height: 1;
}

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

.modern-badge-success {
    background: var(--customer-success-light);
    color: #155724;
}

.modern-badge-info {
    background: var(--customer-info-light);
    color: #0c5460;
}

.modern-badge-warning {
    background: var(--customer-warning-light);
    color: #856404;
}

.modern-badge-danger {
    background: var(--customer-danger-light);
    color: #721c24;
}

/* ========== Modal Enhancements ========== */
.modern-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.modern-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modern-modal-content {
    background: var(--customer-white);
    border-radius: var(--customer-border-radius-lg);
    box-shadow: var(--customer-shadow-xl);
    max-width: 600px;
    width: 100%;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modern-modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--customer-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modern-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--customer-text-primary);
    margin: 0;
}

.modern-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--customer-text-muted);
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--customer-transition-fast);
}

.modern-modal-close:hover {
    background: var(--customer-gray-100);
    color: var(--customer-text-primary);
}

.modern-modal-body {
    padding: 2rem;
}

.modern-modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--customer-border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ========== Info Card Display ========== */
.info-card {
    background: var(--customer-gray-50);
    border-radius: var(--customer-border-radius);
    padding: var(--customer-spacing-lg);
    margin-bottom: var(--customer-spacing-md);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--customer-gray-200);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: var(--customer-text-secondary);
    font-size: 0.9rem;
}

.info-value {
    font-weight: 600;
    color: var(--customer-text-primary);
    font-size: 1rem;
}

.info-value.highlight {
    color: var(--customer-primary);
    font-size: 1.25rem;
}

/* ========== QR Code Display ========== */
.qr-code-wrapper {
    text-align: center;
    padding: var(--customer-spacing-lg);
    background: var(--customer-white);
    border-radius: var(--customer-border-radius);
    border: 2px dashed var(--customer-gray-300);
}

.qr-code-wrapper img {
    max-width: 200px;
    height: auto;
    border-radius: var(--customer-border-radius-sm);
}

/* ========== Loading States ========== */
.modern-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid var(--customer-gray-200);
    border-top-color: var(--customer-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--customer-gray-200);
    border-top-color: var(--customer-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

/* ========== Discount/Offer Cards ========== */
.discount-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.discount-card {
    background: var(--customer-white);
    border-radius: var(--customer-border-radius-lg);
    overflow: hidden;
    box-shadow: var(--customer-shadow);
    transition: var(--customer-transition);
    border: 1px solid var(--customer-border-color);
}

.discount-card:hover {
    box-shadow: var(--customer-shadow-lg);
    transform: translateY(-4px);
}

.discount-card-image {
    position: relative;
    overflow: hidden;
    height: 200px;
}

.discount-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--customer-transition-slow);
}

.discount-card:hover .discount-card-image img {
    transform: scale(1.05);
}

.discount-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--customer-danger);
    color: var(--customer-white);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: var(--customer-shadow);
}

.discount-card-body {
    padding: 1.5rem;
}

.discount-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--customer-text-primary);
    margin-bottom: 0.75rem;
}

.discount-card-description {
    color: var(--customer-text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.discount-card-footer {
    padding: 1rem 1.5rem;
    background: var(--customer-gray-50);
    border-top: 1px solid var(--customer-border-color);
}

/* ========== Radio/Checkbox Custom Styles ========== */
.modern-radio-group,
.modern-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.modern-radio-option,
.modern-checkbox-option {
    position: relative;
    flex: 0 0 calc(50% - 0.5rem);
}

.modern-radio-option input[type="radio"],
.modern-checkbox-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.modern-radio-label,
.modern-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: 2px solid var(--customer-gray-200);
    border-radius: var(--customer-border-radius-sm);
    cursor: pointer;
    transition: var(--customer-transition-fast);
    background: var(--customer-white);
}

.modern-radio-option input[type="radio"]:checked+.modern-radio-label,
.modern-checkbox-option input[type="checkbox"]:checked+.modern-checkbox-label {
    border-color: var(--customer-primary);
    background: rgba(103, 119, 239, 0.05);
}

.modern-radio-label::before {
    content: '';
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--customer-gray-300);
    border-radius: 50%;
    transition: var(--customer-transition-fast);
}

.modern-radio-option input[type="radio"]:checked+.modern-radio-label::before {
    border-color: var(--customer-primary);
    background: var(--customer-primary);
    box-shadow: inset 0 0 0 3px var(--customer-white);
}

/* ========== Responsive Utilities ========== */
@media (max-width: 768px) {
    .modern-card {
        padding: var(--customer-spacing-lg);
    }

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

    .modern-modal {
        padding: 1rem;
    }

    .modern-modal-body {
        padding: 1.5rem;
    }

    .modern-radio-option,
    .modern-checkbox-option {
        flex: 0 0 100%;
    }
}

/* ========== Animation Utilities ========== */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-up {
    animation: slideUp 0.5s ease;
}

.bounce-in {
    animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========== Empty States ========== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--customer-gray-300);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--customer-text-primary);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    color: var(--customer-text-secondary);
    margin-bottom: 1.5rem;
}

/* ========== Success State ========== */
.success-state {
    text-align: center;
    padding: 2rem;
}

.success-state-icon {
    width: 5rem;
    height: 5rem;
    background: var(--customer-success-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    animation: bounceIn 0.6s ease;
}

.success-state-icon i {
    font-size: 2.5rem;
    color: var(--customer-success);
}

/* ========== Skeleton Loading ========== */
.skeleton {
    background: linear-gradient(90deg, var(--customer-gray-200) 25%, var(--customer-gray-100) 50%, var(--customer-gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--customer-border-radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}