/**
 * CBP My Account Widget - Scoped CSS
 * Modern, isolated styling for WooCommerce My Account
 * High specificity to prevent conflicts with other themes/plugins
 */

/* === CSS Variables === */
.cbp-ma-wrapper {
    --cbp-primary: #10b981;
    --cbp-primary-hover: #059669;
    --cbp-secondary: #6366f1;
    --cbp-text: #1f2937;
    --cbp-text-light: #6b7280;
    --cbp-bg: #ffffff;
    --cbp-bg-alt: #f8f9fa;
    --cbp-border: #e5e7eb;
    --cbp-radius: 12px;
    --cbp-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --cbp-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Main Container === */
.cbp-ma-wrapper.cbp-ma-wrapper.cbp-ma-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    line-height: 1.6 !important;
    color: var(--cbp-text) !important;
    background: var(--cbp-bg) !important;
    border-radius: var(--cbp-radius) !important;
    box-shadow: var(--cbp-shadow) !important;
    overflow: hidden !important;
}

/* === Header with Avatar === */
.cbp-ma-wrapper .cbp-ma-header {
    display: flex !important;
    align-items: center !important;
    gap: 20px !important;
    padding: 30px !important;
    background: linear-gradient(135deg, var(--cbp-primary) 0%, var(--cbp-secondary) 100%) !important;
    color: #fff !important;
}

.cbp-ma-wrapper .cbp-ma-avatar {
    flex-shrink: 0 !important;
}

.cbp-ma-wrapper .cbp-ma-avatar img {
    width: 80px !important;
    height: 80px !important;
    border-radius: 50% !important;
    border: 4px solid rgba(255,255,255,0.3) !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
    object-fit: cover !important;
}

.cbp-ma-wrapper .cbp-ma-welcome {
    display: flex !important;
    flex-direction: column !important;
}

.cbp-ma-wrapper .cbp-ma-greeting {
    font-size: 14px !important;
    opacity: 0.9 !important;
    font-weight: 400 !important;
}

.cbp-ma-wrapper .cbp-ma-username {
    font-size: 24px !important;
    font-weight: 700 !important;
    letter-spacing: -0.5px !important;
}

/* === Body Layout === */
.cbp-ma-wrapper .cbp-ma-body {
    display: flex !important;
    min-height: 400px !important;
}

/* Sidebar Layout */
.cbp-ma-wrapper.cbp-ma-layout-sidebar .cbp-ma-body {
    flex-direction: row !important;
}

.cbp-ma-wrapper.cbp-ma-layout-sidebar .cbp-ma-nav {
    width: 280px !important;
    flex-shrink: 0 !important;
    background: var(--cbp-bg-alt) !important;
    border-right: 1px solid var(--cbp-border) !important;
}

.cbp-ma-wrapper.cbp-ma-layout-sidebar .cbp-ma-content {
    flex: 1 !important;
    padding: 30px !important;
}

/* Tabs Layout */
.cbp-ma-wrapper.cbp-ma-layout-tabs .cbp-ma-body {
    flex-direction: column !important;
}

.cbp-ma-wrapper.cbp-ma-layout-tabs .cbp-ma-nav {
    border-bottom: 1px solid var(--cbp-border) !important;
    background: var(--cbp-bg-alt) !important;
}

.cbp-ma-wrapper.cbp-ma-layout-tabs .cbp-ma-nav-list {
    display: flex !important;
    flex-wrap: wrap !important;
    padding: 0 20px !important;
}

.cbp-ma-wrapper.cbp-ma-layout-tabs .cbp-ma-nav-item {
    margin-bottom: -1px !important;
}

.cbp-ma-wrapper.cbp-ma-layout-tabs .cbp-ma-content {
    padding: 30px !important;
}

/* === Navigation === */
.cbp-ma-wrapper .cbp-ma-nav-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 15px !important;
}

.cbp-ma-wrapper .cbp-ma-nav-item {
    margin: 0 !important;
    padding: 0 !important;
}

.cbp-ma-wrapper .cbp-ma-nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 14px 18px !important;
    color: var(--cbp-text) !important;
    text-decoration: none !important;
    border-radius: 10px !important;
    font-weight: 500 !important;
    font-size: 15px !important;
    transition: var(--cbp-transition) !important;
    margin-bottom: 4px !important;
}

.cbp-ma-wrapper .cbp-ma-nav-link:hover {
    background: rgba(16, 185, 129, 0.1) !important;
    color: var(--cbp-primary) !important;
    transform: translateX(4px) !important;
}

.cbp-ma-wrapper .cbp-ma-nav-link.is-active {
    background: var(--cbp-primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

.cbp-ma-wrapper .cbp-ma-nav-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
}

.cbp-ma-wrapper .cbp-ma-nav-icon svg {
    width: 20px !important;
    height: 20px !important;
}

/* === Hide Default WooCommerce Nav === */
.cbp-ma-wrapper.cbp-ma-hide-wc-nav .woocommerce-MyAccount-navigation {
    display: none !important;
}

.cbp-ma-wrapper.cbp-ma-hide-wc-nav .woocommerce-MyAccount-content {
    width: 100% !important;
    float: none !important;
}

/* === Content Styling === */
.cbp-ma-wrapper .cbp-ma-content {
    background: var(--cbp-bg) !important;
}

.cbp-ma-wrapper .cbp-ma-content h2,
.cbp-ma-wrapper .cbp-ma-content h3 {
    color: var(--cbp-text) !important;
    font-weight: 600 !important;
    margin-bottom: 20px !important;
}

.cbp-ma-wrapper .cbp-ma-content table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 20px 0 !important;
}

.cbp-ma-wrapper .cbp-ma-content table th,
.cbp-ma-wrapper .cbp-ma-content table td {
    padding: 15px !important;
    text-align: left !important;
    border-bottom: 1px solid var(--cbp-border) !important;
}

.cbp-ma-wrapper .cbp-ma-content table th {
    background: var(--cbp-bg-alt) !important;
    font-weight: 600 !important;
    color: var(--cbp-text) !important;
}

/* === Buttons === */
.cbp-ma-wrapper .cbp-ma-content .button,
.cbp-ma-wrapper .cbp-ma-content .woocommerce-Button,
.cbp-ma-wrapper .cbp-ma-content button[type="submit"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 24px !important;
    background: var(--cbp-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: var(--cbp-transition) !important;
    text-decoration: none !important;
}

.cbp-ma-wrapper .cbp-ma-content .button:hover,
.cbp-ma-wrapper .cbp-ma-content .woocommerce-Button:hover,
.cbp-ma-wrapper .cbp-ma-content button[type="submit"]:hover {
    background: var(--cbp-primary-hover) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

/* === Forms === */
.cbp-ma-wrapper .cbp-ma-content input[type="text"],
.cbp-ma-wrapper .cbp-ma-content input[type="email"],
.cbp-ma-wrapper .cbp-ma-content input[type="password"],
.cbp-ma-wrapper .cbp-ma-content input[type="tel"],
.cbp-ma-wrapper .cbp-ma-content select,
.cbp-ma-wrapper .cbp-ma-content textarea {
    width: 100% !important;
    padding: 12px 16px !important;
    border: 2px solid var(--cbp-border) !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    transition: var(--cbp-transition) !important;
    background: var(--cbp-bg) !important;
}

.cbp-ma-wrapper .cbp-ma-content input:focus,
.cbp-ma-wrapper .cbp-ma-content select:focus,
.cbp-ma-wrapper .cbp-ma-content textarea:focus {
    outline: none !important;
    border-color: var(--cbp-primary) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

.cbp-ma-wrapper .cbp-ma-content label {
    display: block !important;
    margin-bottom: 8px !important;
    font-weight: 500 !important;
    color: var(--cbp-text) !important;
}

/* === Login Form === */
.cbp-ma-wrapper .cbp-ma-login {
    padding: 60px 40px !important;
    text-align: center !important;
}

.cbp-ma-wrapper .cbp-ma-login h3 {
    font-size: 28px !important;
    font-weight: 700 !important;
    margin-bottom: 10px !important;
    color: var(--cbp-text) !important;
}

.cbp-ma-wrapper .cbp-ma-login p {
    color: var(--cbp-text-light) !important;
    margin-bottom: 30px !important;
}

/* === Cards Layout === */
.cbp-ma-wrapper.cbp-ma-layout-cards .cbp-ma-nav-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    gap: 15px !important;
    padding: 20px !important;
}

.cbp-ma-wrapper.cbp-ma-layout-cards .cbp-ma-nav-link {
    flex-direction: column !important;
    text-align: center !important;
    padding: 25px 20px !important;
    background: var(--cbp-bg) !important;
    border: 2px solid var(--cbp-border) !important;
    border-radius: 12px !important;
}

.cbp-ma-wrapper.cbp-ma-layout-cards .cbp-ma-nav-link:hover {
    border-color: var(--cbp-primary) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
}

.cbp-ma-wrapper.cbp-ma-layout-cards .cbp-ma-nav-icon {
    width: 48px !important;
    height: 48px !important;
    margin-bottom: 12px !important;
    padding: 12px !important;
    background: var(--cbp-bg-alt) !important;
    border-radius: 12px !important;
}

/* === Responsive === */
@media (max-width: 768px) {
    .cbp-ma-wrapper.cbp-ma-layout-sidebar .cbp-ma-body {
        flex-direction: column !important;
    }

    .cbp-ma-wrapper.cbp-ma-layout-sidebar .cbp-ma-nav {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--cbp-border) !important;
    }

    .cbp-ma-wrapper .cbp-ma-header {
        flex-direction: column !important;
        text-align: center !important;
        padding: 25px !important;
    }

    .cbp-ma-wrapper .cbp-ma-nav-list {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .cbp-ma-wrapper .cbp-ma-nav-link {
        padding: 10px 14px !important;
        font-size: 13px !important;
    }

    .cbp-ma-wrapper .cbp-ma-nav-text {
        display: none !important;
    }

    .cbp-ma-wrapper .cbp-ma-nav-link.is-active .cbp-ma-nav-text {
        display: inline !important;
    }
}

/* === Animations === */
@keyframes cbp-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cbp-ma-wrapper .cbp-ma-content > * {
    animation: cbp-fadeIn 0.4s ease-out !important;
}

/* === Notice === */
.cbp-ma-wrapper .cbp-ma-notice {
    padding: 40px !important;
    text-align: center !important;
    color: var(--cbp-text-light) !important;
    background: var(--cbp-bg-alt) !important;
    border-radius: var(--cbp-radius) !important;
}
