/**
 * AffiliEarn Custom CSS3 Stylesheet
 * 100% Pure Custom CSS3 - No frameworks
 * Mobile-First Responsive Design
 */

:root {
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --primary-light: #EFF6FF;
    --earning: #16A34A;
    --earning-light: #DCFCE7;
    --earning-border: #BBF7D0;
    --dark: #111827;
    --secondary: #6B7280;
    --bg: #F8FAFC;
    --card: #FFFFFF;
    --border: #E5E7EB;
    --error: #DC2626;
    --error-light: #FEE2E2;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --radius-card: 16px;
    --radius-btn: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    color: var(--dark);
    background-color: var(--bg);
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    color: var(--dark);
    line-height: 1.5;
    padding-bottom: 76px; /* Space for bottom fixed navigation */
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--dark);
    font-weight: 700;
    line-height: 1.25;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p {
    color: var(--secondary);
    font-size: 0.95rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 540px; /* Mobile first centered phone view on desktop */
    margin: 0 auto;
    padding: 16px;
    flex: 1;
}

/* Wide container for Admin portal desktop / tablet */
.app-container-wide {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
    flex: 1;
}

/* Top App Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background-color: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    flex-direction: column;
}

.header-greeting {
    font-size: 0.82rem;
    color: var(--secondary);
    font-weight: 500;
}

.header-user-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-balance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--earning-light);
    border: 1px solid var(--earning-border);
    color: var(--earning);
    padding: 6px 12px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
}

.profile-avatar-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    transition: transform 0.1s ease;
}

.profile-avatar-btn:active {
    transform: scale(0.95);
}

/* Bottom Fixed Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 50;
    padding: 4px 8px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--secondary);
    font-size: 0.72rem;
    font-weight: 500;
    flex: 1;
    min-height: 48px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
    margin-bottom: 2px;
    stroke-width: 2;
}

.bottom-nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

.bottom-nav-item:active {
    background-color: var(--primary-light);
}

/* Cards */
.card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.card-hero {
    background: linear-gradient(135deg, #1E40AF 0%, #2563EB 100%);
    color: #FFFFFF;
    border: none;
    padding: 20px;
}

.card-hero h2, .card-hero p, .card-hero span {
    color: #FFFFFF;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-btn);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
    min-height: 44px; /* Accessible touch target */
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: #FFFFFF;
}

.btn-success {
    background-color: var(--earning);
    color: #FFFFFF;
}

.btn-success:hover {
    background-color: #15803D;
    color: #FFFFFF;
}

.btn-secondary {
    background-color: #F1F5F9;
    color: var(--dark);
    border-color: var(--border);
}

.btn-secondary:hover {
    background-color: #E2E8F0;
}

.btn-danger {
    background-color: var(--error);
    color: #FFFFFF;
}

.btn-danger:hover {
    background-color: #B91C1C;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    min-height: 36px;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
    display: flex;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    background-color: #FFFFFF;
    color: var(--dark);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-height: 44px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Input With Icon & Password Visibility Toggle */
.input-icon-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-icon-prefix {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
    transition: color 0.15s ease;
    width: 20px;
    height: 20px;
}

.input-icon-prefix svg {
    width: 19px;
    height: 19px;
    stroke-width: 2;
}

.input-icon-group:focus-within .input-icon-prefix {
    color: var(--primary);
}

.input-icon-group .form-control {
    padding-left: 42px;
}

.input-icon-group .form-control.has-toggle {
    padding-right: 44px;
}

.password-toggle-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 8px 10px;
    color: var(--secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background-color 0.15s ease;
    z-index: 3;
    line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.password-toggle-btn:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.password-toggle-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.password-toggle-btn svg {
    width: 19px;
    height: 19px;
    stroke-width: 2;
}

textarea.form-control {
    min-height: 90px;
    resize: vertical;
}

.form-text {
    font-size: 0.8rem;
    color: var(--secondary);
    margin-top: 4px;
}

/* Alerts / Flash Messages */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-btn);
    margin-bottom: 16px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background-color: var(--earning-light);
    color: #166534;
    border: 1px solid var(--earning-border);
}

.alert-error, .alert-danger {
    background-color: var(--error-light);
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-warning {
    background-color: var(--warning-light);
    color: #92400E;
    border: 1px solid #FDE68A;
}

.alert-info {
    background-color: var(--primary-light);
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: var(--earning-light);
    color: var(--earning);
}

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

.badge-warning {
    background-color: var(--warning-light);
    color: #B45309;
}

.badge-danger {
    background-color: var(--error-light);
    color: var(--error);
}

.badge-secondary {
    background-color: #F1F5F9;
    color: var(--secondary);
}

/* Offer Card Items */
.offer-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    margin-bottom: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.offer-card:hover {
    box-shadow: var(--shadow-md);
}

.offer-thumb {
    width: 58px;
    height: 58px;
    border-radius: 12px;
    object-fit: cover;
    background-color: #F1F5F9;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.offer-content {
    flex: 1;
    min-width: 0;
}

.offer-advertiser {
    font-size: 0.78rem;
    color: var(--secondary);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.offer-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
    line-height: 1.3;
}

.offer-desc {
    font-size: 0.85rem;
    color: var(--secondary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.offer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.reward-highlight {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--earning);
}

/* Goal Step List */
.goal-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 14px 0;
}

.goal-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background-color: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
}

.goal-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.goal-step-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.goal-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--dark);
}

.goal-payout {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--earning);
    white-space: nowrap;
}

/* Transaction Ledger List */
.ledger-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.ledger-left {
    display: flex;
    flex-direction: column;
}

.ledger-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--dark);
}

.ledger-date {
    font-size: 0.78rem;
    color: var(--secondary);
}

.ledger-amount-credit {
    font-size: 1rem;
    font-weight: 700;
    color: var(--earning);
}

.ledger-amount-debit {
    font-size: 1rem;
    font-weight: 700;
    color: var(--error);
}

/* Responsive Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background-color: #F8FAFC;
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.table tr:hover {
    background-color: #F9FAFB;
}

/* Metric / Stats Cards */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 14px;
}

.stat-card-label {
    font-size: 0.8rem;
    color: var(--secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-card-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--dark);
}

.stat-card-sub {
    font-size: 0.75rem;
    color: var(--secondary);
    margin-top: 2px;
}

/* Admin Top Bar & Desktop Navigation */
.admin-header {
    background-color: #0F172A;
    color: #FFFFFF;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.admin-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-brand {
    font-size: 1.1rem;
    font-weight: 800;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-badge {
    background: #2563EB;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}

.admin-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    white-space: nowrap;
    padding: 8px 0;
}

.admin-nav-link {
    color: #94A3B8;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.admin-nav-link:hover, .admin-nav-link.active {
    color: #FFFFFF;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Copy Box */
.copy-box {
    display: flex;
    align-items: center;
    background-color: #F1F5F9;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    padding: 6px 10px;
    gap: 8px;
}

.copy-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--dark);
}

/* Goal dynamic row in Admin */
.goal-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--earning); }
.text-danger { color: var(--error); }
.text-muted { color: var(--secondary); }
.fw-bold { font-weight: 700; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }

@media (min-width: 768px) {
    .grid-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Continue with Google & Unified Auth Styling */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    background-color: #FFFFFF;
    color: #3C4043;
    border: 1px solid #DADCE0;
    border-radius: var(--radius-btn);
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
    transition: background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
    user-select: none;
}

.btn-google:hover {
    background-color: #F8F9FA;
    border-color: #C6C8CA;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.16);
}

.btn-google:active {
    background-color: #EEEEEE;
}

.btn-google svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 18px 0;
    color: var(--secondary);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.auth-divider:not(:empty)::before {
    margin-right: 12px;
}

.auth-divider:not(:empty)::after {
    margin-left: 12px;
}

.google-user-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background-color: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    margin-bottom: 16px;
}

.google-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
    border: 2px solid #FFFFFF;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.google-badge-verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--earning);
    background: #E6F4EA;
    padding: 2px 8px;
    border-radius: 999px;
    margin-top: 2px;
}

.remember-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--dark);
    user-select: none;
}

.remember-checkbox-group input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Modal Popup for Google Account Selection */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal-dialog {
    background: #FFFFFF;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 20px;
}

.google-account-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #FFFFFF;
    text-align: left;
    width: 100%;
}

.google-account-item:hover {
    background: #F8FAFC;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

