/* 
 * WAIVAA Client Portal - Premium UI System
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-app: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Reset & Base */
.waivaa-dashboard-wrapper * {
    box-sizing: border-box;
}

.waivaa-dashboard-wrapper {
    font-family: 'Inter', sans-serif;
    background: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
}

/* Layout */
.waivaa-dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.waivaa-sidebar {
    width: 260px;
    background: #0f172a;
    color: white;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    padding: 30px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    background: var(--primary);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.brand-logo svg {
    width: 100%;
    height: 100%;
}

.brand-text {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.5px;
}

.brand-text span {
    color: var(--primary);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 12px;
}

.waivaa-nav-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.waivaa-nav-item {
    margin-bottom: 4px !important;
    list-style: none !important;
}

.waivaa-nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none !important;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.waivaa-nav-item a:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.waivaa-nav-item.is-active a {
    background: var(--primary);
    color: white;
}

.nav-icon {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #fca5a5;
    text-decoration: none !important;
    font-weight: 600;
}

/* Main Content */
.waivaa-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.waivaa-topbar {
    background: white;
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.waivaa-topbar h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.waivaa-content-area {
    padding: 32px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg { width: 28px; height: 28px; }

.icon-blue { background: #eff6ff; color: #2563eb; }
.icon-green { background: #ecfdf5; color: #10b981; }
.icon-purple { background: #f5f3ff; color: #8b5cf6; }

.stat-label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 800;
    margin-top: 4px;
}

.status-active { color: var(--success); }

/* Content Cards */
.grid-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

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

.card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.card-body { padding: 24px; }

/* Dashboard Overview Specifics */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-item {
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.chat-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.chat-phone { font-weight: 700; font-size: 13px; }
.chat-time { font-size: 12px; color: var(--text-muted); }

.chat-preview p { margin: 4px 0; font-size: 13px; }
.msg-in span { color: var(--primary); font-weight: 600; }
.msg-out span { color: var(--success); font-weight: 600; }

.quick-info .info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 14px;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* Forms & Inputs */
.premium-form .form-group { margin-bottom: 24px; }
.premium-form label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }

.premium-form input[type="text"],
.premium-form input[type="password"],
.premium-form input[type="email"],
.premium-form textarea,
.premium-form select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.premium-form input:focus, .premium-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    outline: none;
}

/* Tone Selector */
.tone-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.tone-option input { display: none; }
.tone-card {
    border: 1.5px solid var(--border);
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.tone-option input:checked + .tone-card {
    border-color: var(--primary);
    background: var(--primary-light);
}

.tone-title { display: block; font-weight: 700; font-size: 14px; }
.tone-desc { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* FAQ List */
.premium-faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.premium-faq-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.faq-q { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.faq-a { font-size: 13px; color: var(--text-muted); }

.faq-actions { display: flex; gap: 8px; }
.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #f1f5f9;
    border: none;
    color: var(--text-muted);
}

.edit-faq:hover { background: var(--primary-light); color: var(--primary); }
.delete-faq:hover { background: #fee2e2; color: var(--danger); }

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

.btn-outline:hover { background: #f8fafc; border-color: var(--text-muted); }

.full-width { width: 100%; }

/* Subscription Card */
.subscription-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 40px;
    border-radius: 24px;
}

.sub-header { display: flex; justify-content: space-between; margin-bottom: 30px; }
.sub-plan-name { font-size: 32px; font-weight: 800; margin: 5px 0; }
.sub-details { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; }
.detail-label { display: block; color: #94a3b8; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.detail-value { font-size: 18px; font-weight: 700; }

/* Sections Display */
.waivaa-section { display: none; animation: fadeIn 0.3s ease; }
.waivaa-section.is-active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 1024px) {
    .waivaa-sidebar { width: 80px; }
    .brand-text, .nav-label { display: none; }
    .sidebar-brand { justify-content: center; }
    .waivaa-nav-item a { justify-content: center; }
}

@media (max-width: 768px) {
    .waivaa-dashboard-layout { flex-direction: column; }
    .waivaa-sidebar { width: 100%; height: auto; position: relative; }
    .waivaa-nav-list { display: flex; overflow-x: auto; padding: 10px !important; }
    .content-grid { grid-template-columns: 1fr; }
}

/* Form Pending Styles */
.wcpp-form-container {
    max-width: 450px;
    margin: 60px auto;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.wcpp-form-container h2 { margin-bottom: 10px; font-weight: 800; }
.wcpp-form-container .subtitle { color: var(--text-muted); margin-bottom: 30px; }

/* Premium Auth Styles */
.wcpp-auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    background: var(--bg-app);
    min-height: calc(100vh - 100px);
}

.wcpp-auth-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    padding: 48px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: fadeIn 0.4s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 24px;
    margin: 0 auto 20px;
}

.auth-header h2 {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
}

.auth-header .subtitle {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
}

.auth-header .pending-highlight {
    color: var(--warning);
    font-weight: 700;
}

/* Auth Form Elements */
.premium-auth-form .form-group {
    margin-bottom: 24px;
}

.premium-auth-form label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.premium-auth-form input {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: #fff;
    box-sizing: border-box;
}

.premium-auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.auth-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Icons & Info */
.auth-icon-pending, .auth-icon-success {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.auth-icon-pending { background: #fff7ed; color: #f97316; }
.auth-icon-success { background: #f0fdf4; color: #22c55e; }

.auth-icon-pending svg, .auth-icon-success svg { width: 32px; height: 32px; }

.auth-pending-info {
    background: #f8fafc;
    padding: 24px;
    border-radius: 16px;
    border: 1px dashed var(--border);
    margin-bottom: 30px;
    text-align: center;
}

.auth-pending-info p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.6;
}

.auth-pending-info p:last-child { margin-bottom: 0; }

.auth-error-msg {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    margin-bottom: 24px;
    border: 1px solid #fecaca;
    font-weight: 600;
}

/* Grid Layout for Registration */
.wcpp-auth-card .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .wcpp-auth-card .form-grid {
        grid-template-columns: 1fr;
    }
    .wcpp-auth-card {
        padding: 32px 24px;
    }
}

/* Health Banner */
.health-banner {
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow);
}

.health-good { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.health-warning { background: #fffbeb; border: 1px solid #fef3c7; color: #92400e; }

.health-content { display: flex; align-items: center; gap: 16px; }
.health-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.5); }
.health-icon svg { width: 24px; height: 24px; }
.health-text h3 { margin: 0; font-size: 18px; }
.health-text p { margin: 4px 0 0 0; font-size: 14px; opacity: 0.8; }

.health-progress { height: 8px; background: rgba(0,0,0,0.05); border-radius: 4px; overflow: hidden; }
.health-progress .progress-bar { height: 100%; background: currentColor; transition: width 1s ease-in-out; }

/* Onboarding Steps */
.onboarding-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.step-item { display: flex; align-items: center; gap: 12px; color: var(--text-muted); }
.step-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.step-done { color: var(--success); }
.step-done .step-check { background: var(--success); color: white; border-color: var(--success); }
.step-label { font-size: 14px; font-weight: 600; }

.form-divider { height: 1px; background: var(--border); margin: 32px 0; }
.prompt-tips { margin-top: 12px; font-size: 12px; color: var(--text-muted); background: #f8fafc; padding: 12px; border-radius: 8px; border-left: 4px solid var(--primary); }

/* Subscription & Billing Enhancements */
.billing-card {
    overflow: hidden;
}

.billing-hero {
    align-items: flex-start;
    gap: 24px;
}

.sub-description {
    margin: 10px 0 0;
    color: #cbd5e1;
    max-width: 680px;
    line-height: 1.6;
}

.billing-status-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.badge-warning {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.badge-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.trial-countdown-panel {
    margin: 24px 0;
    padding: 24px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.trial-countdown-copy h3 {
    margin: 6px 0;
    color: #ffffff;
    font-size: 28px;
    line-height: 1.2;
}

.trial-countdown-copy p {
    margin: 0 0 18px;
    color: #cbd5e1;
}

.trial-meter {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    overflow: hidden;
}

.trial-meter-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #38bdf8);
    transition: width 0.3s ease;
}

.billing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.billing-info-card {
    padding: 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.billing-info-card .detail-label,
.billing-info-card .detail-value {
    display: block;
}

.billing-info-card .detail-value {
    margin-top: 8px;
    color: #ffffff;
}

.strong-value {
    font-weight: 800;
}

.billing-note {
    margin-top: 20px;
    padding: 18px 20px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
}

.billing-note strong {
    display: block;
    color: #ffffff;
    margin-bottom: 6px;
}

.billing-note p {
    margin: 0;
}

@media (max-width: 1024px) {
    .billing-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .billing-hero {
        flex-direction: column;
    }

    .billing-status-stack {
        align-items: flex-start;
    }

    .billing-grid,
    .sub-details {
        grid-template-columns: 1fr;
    }

    .trial-countdown-panel {
        padding: 20px;
    }
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1;
}

.badge-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 45px !important;
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

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

/* Checkbox Styling */
.checkbox-group {
    margin-top: 10px;
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px;
    cursor: pointer;
    font-weight: 500 !important;
    font-size: 14px !important;
    color: var(--text-muted) !important;
    line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.checkbox-text a:hover {
    text-decoration: underline;
}

/* Multi-step Registration Styling */
.registration-progress-wrapper {
    margin-bottom: 40px;
    position: relative;
    padding: 0 10px;
}

.progress-bar-container {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    position: absolute;
    top: 15px;
    left: 40px;
    right: 40px;
    z-index: 1;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 2px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

.step-indicator {
    width: 34px;
    height: 34px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.step-indicator.active {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.step-indicator.completed {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.form-step {
    display: none;
    animation: fadeIn 0.4s ease;
}

.form-step.active {
    display: block;
}

.step-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.step-actions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.step-actions.dual-actions {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.step-actions .btn-primary, .step-actions .btn-outline {
    flex: 1;
    padding: 14px 24px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
