/* Customer Portal CSS - Mobile-First Design */

/* ============================================
   BASE STYLES
   ============================================ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #fff7ed 100%);
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ============================================
   LAYOUT
   ============================================ */

.customer-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary-custom:active {
    transform: translateY(0);
}

.btn-primary-custom:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-google:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

/* ============================================
   CARDS
   ============================================ */

.card-custom {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.card-gradient {
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-control {
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-group-text {
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.input-group .form-control {
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.input-group .btn {
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* OTP Input */
.otp-input {
    width: 48px !important;
    height: 56px !important;
    font-size: 1.5rem !important;
    text-align: center;
    border-radius: var(--radius-lg) !important;
    border: 2px solid var(--gray-200) !important;
    transition: all 0.2s ease;
}

.otp-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav-pills .nav-link {
    color: var(--gray-600);
    border-radius: var(--radius-lg);
    padding: 0.625rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-pills .nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-pills .nav-link:hover:not(.active) {
    background: var(--gray-100);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-100);
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.bottom-nav-item i {
    font-size: 1.25rem;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item:hover {
    color: var(--primary);
}

/* Scan button (center) */
.bottom-nav-scan {
    position: relative;
    top: -1rem;
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    color: white !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.bottom-nav-scan i {
    font-size: 1.5rem !important;
}

/* ============================================
   LOYALTY CARD
   ============================================ */

.loyalty-card {
    background: var(--gradient-primary);
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.loyalty-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.loyalty-points {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.loyalty-tier {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ============================================
   VOUCHER CARD
   ============================================ */

.voucher-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
}

.voucher-left {
    flex-shrink: 0;
    width: 100px;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
}

.voucher-left::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
}

.voucher-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.voucher-right {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.voucher-title {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.voucher-expiry {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.voucher-used {
    opacity: 0.6;
    position: relative;
}

.voucher-used::after {
    content: 'DA SU DUNG';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    padding: 0.5rem 1rem;
    background: var(--danger);
    color: white;
    font-weight: 700;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* ============================================
   TRANSACTION LIST
   ============================================ */

.transaction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.transaction-icon.earn {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.transaction-icon.spend {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.transaction-content {
    flex: 1;
    min-width: 0;
}

.transaction-title {
    font-weight: 500;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transaction-date {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.transaction-points {
    font-weight: 600;
    white-space: nowrap;
}

.transaction-points.earn {
    color: var(--success);
}

.transaction-points.spend {
    color: var(--danger);
}

/* ============================================
   TOAST / ALERTS
   ============================================ */

.toast-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: calc(100% - 2rem);
    max-width: 400px;
}

.toast-custom {
    padding: 1rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    animation: slideDown 0.3s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast-success {
    background: var(--success);
    color: white;
}

.toast-danger {
    background: var(--danger);
    color: white;
}

.toast-warning {
    background: var(--warning);
    color: white;
}

.toast-info {
    background: var(--info);
    color: white;
}

/* ============================================
   BADGE / TAG
   ============================================ */

.badge-custom {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* ============================================
   PROFILE
   ============================================ */

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
}

.profile-stat {
    text-align: center;
    padding: 1rem;
}

.profile-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.profile-stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
}

.profile-menu-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.profile-menu-item i {
    width: 24px;
    text-align: center;
    font-size: 1.25rem;
}

.profile-menu-item .bi-chevron-right {
    margin-left: auto;
    color: var(--gray-400);
}

/* ============================================
   UTILITIES
   ============================================ */

.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.bg-primary-light { background: rgba(99, 102, 241, 0.1) !important; }
.bg-success-light { background: rgba(34, 197, 94, 0.1) !important; }

.divider {
    height: 1px;
    background: var(--gray-200);
    margin: 1rem 0;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 768px) {
    .customer-container {
        padding: 2rem;
    }
}

/* iOS Safe Area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }

    .customer-container {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}
