/*
Plugin Name: PVD User Dashboard
Description: Custom styles for the front-end user dashboard.
*/

.pvd-user-dashboard-wrapper {
    /* Polished “card” container */
    max-width: 1100px;
    margin: 30px auto;
    padding: 24px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 14px;

    /* Prefer theme variables when present */
    background: var(--wp--preset--color--secondary, #ffffff);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    backdrop-filter: saturate(1.1);
}

.pvd-user-dashboard-wrapper h1,
.pvd-user-dashboard-wrapper h2 {
    color: inherit;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

.pvd-user-dashboard-wrapper h1 {
    font-size: 28px;
    margin-top: 0;
}

.pvd-user-dashboard-wrapper h2 {
    font-size: 20px;
}

#pvd-profile-update-form { /* Updated ID */
    max-width: 600px;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;

}

#pvd-profile-update-form p {
    margin-bottom: 15px;
}

#pvd-profile-update-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;

}

#pvd-profile-update-form input[type="text"],
#pvd-profile-update-form input[type="email"],
#pvd-profile-update-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

#pvd-profile-update-form input[type="email"][readonly] {
    background-color: #e9e9e9;
    cursor: not-allowed;
}

#pvd-profile-update-form textarea {
    min-height: 100px;
    resize: vertical;
}

#pvd-profile-update-form input[type="submit"] {
    background-color: #0073aa;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

#pvd-profile-update-form input[type="submit"]:hover {
    background-color: #005177;
}

#pvd-profile-update-message { /* Updated ID */
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    display: none;
}

/* Dashboard Navigation */
.dashboard-nav ul {
    list-style: none;
    padding: 10px;
    margin: 0 0 18px 0;


    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.dashboard-nav li {
    margin: 0;

}

.dashboard-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 10px 12px;
    text-decoration: none;
    color: var(--wp--preset--color--custom-links, #9d9d9d);
    font-weight: 600;
    border-radius: 10px;
    position: relative; /* for badge positioning */

    transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.dashboard-nav a:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.dashboard-nav li:last-child a {
    border-right: none;
}

.dashboard-nav a.active,
.dashboard-nav a:hover {
    background: rgba(34,113,177,0.30);
    color: rgb(134, 150, 161);
}

.pvd-msg-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 7px;

    border-radius: 999px;
    background: #d63638;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;

    box-shadow: 0 6px 16px rgba(214,54,56,0.25);
}

.pvd-messages-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 15px;
    padding: 10px 12px;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    background: rgba(0,0,0,0.02);
}

.pvd-messages-actions__status {
    font-size: 13px;
    opacity: 0.85;
    text-align: right;
}

.pvd-message__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.pvd-message-remove {
    border: 1px solid rgba(0,0,0,0.16);
    background: rgba(0,0,0,0.03);
    color: rgba(0,0,0,0.8);
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.pvd-message-remove:hover {
    background: rgba(0,0,0,0.06);
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    .dashboard-nav ul {
        flex-direction: column;
        padding: 0;
    }

    .dashboard-nav li {
        width: 100%;
        text-align: center;
        margin-bottom: 5px;
    }

    .dashboard-nav a {
        border-right: none;
    }

    .dashboard-nav li:last-child a {
        border-bottom: none;
    }
}

.pvd-message { /* Updated class name */
    background: var(--wp--preset--color--base, #fff);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    padding: 14px 14px 12px;
    margin-bottom: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.pvd-message.is-collapsed {
    box-shadow: 0 5px 14px rgba(0,0,0,0.05);
}

.pvd-message h3 {
    margin-top: 0;
    color: #0a4b78;
    font-size: 16px;
    margin-bottom: 8px;
}

.pvd-message-toggle {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pvd-message-toggle::after {
    content: "▾";
    font-size: 14px;
    opacity: 0.8;
    transform: rotate(0deg);
    transition: transform 120ms ease;
}

.pvd-message.is-collapsed .pvd-message-toggle::after {
    transform: rotate(-90deg);
}

.pvd-message-toggle:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.pvd-message .message-content {
    margin-bottom: 10px;
    color: rgba(0,0,0,0.85);
    line-height: 1.5;
}

.pvd-message .message-date {
    font-size: 12px;
    color: rgba(0,0,0,0.55);
}

/* Dashboard Sections */
.dashboard-section {
    display: none;
    padding: 18px 0 10px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.dashboard-section.active {
    display: block;
    animation: pvdFadeIn 180ms ease-out;
}

/* Orders AJAX loading state */
#my-orders.pvd-orders-loading {
    opacity: 0.65;
    pointer-events: none;
    position: relative;
}

#my-orders.pvd-orders-loading::after {
    content: "Loading…";
    position: absolute;
    top: 12px;
    right: 0;
    font-size: 13px;
    opacity: 0.9;
}

/* -------------------------------------------------------------------------
   Orders table ([pvd_order_history]) styling
   ------------------------------------------------------------------------- */

/* Our shortcode outputs a table with class `edd_purchase_history_table`. */
.pvd-user-dashboard-wrapper .pvd-order-history .edd_purchase_history_table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px; /* creates "card rows" */
}

/* Hide the header row so it reads like a list. */
.pvd-user-dashboard-wrapper .pvd-order-history .edd_purchase_history_table thead {
    display: none;
    visibility: hidden;
}

/* Each order becomes a “card row”. */
.pvd-user-dashboard-wrapper .pvd-order-history .edd_purchase_history_table tbody tr {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: space-between;

    gap: 8px 14px;

    background: var(--wp--preset--color--dark-transparency, #333);
    color: var(--wp--preset--color--text-primary, #333);
    font-size: 1.2em;

    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 5px;
    padding: 14px 14px 12px;
    margin-bottom: 20px;

    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

/* Neutralize zebra striping on TDs. */
.pvd-user-dashboard-wrapper .pvd-order-history .edd_purchase_history_table tbody tr:nth-child(odd) td,
.pvd-user-dashboard-wrapper .pvd-order-history .edd_purchase_history_table tbody tr:nth-child(even) td {
    color: var(--wp--preset--color--text-primary, #333);
    font-size: 1em;
}

/* First column: order */
.pvd-user-dashboard-wrapper .pvd-order-history .edd_purchase_history_table td:first-child {
    font-weight: 700;
    line-height: 1.25;
}

/* Second column: date */
.pvd-user-dashboard-wrapper .pvd-order-history .edd_purchase_history_table td:nth-child(2) {
    font-size: 13px;
    opacity: 0.75;
    white-space: nowrap;
}

/* Last column: details link */
.pvd-user-dashboard-wrapper .pvd-order-history .edd_purchase_history_table td:last-child {
    justify-self: end;
    text-align: right;
    font-size: 13px;
    white-space: nowrap;
}

.pvd-user-dashboard-wrapper .pvd-order-history a.pvd-order-details {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.14);
    background: var(--wp--preset--color--secondary, #333);

    font-weight: 700;
    text-decoration: none;
    line-height: 1;
}

.pvd-user-dashboard-wrapper .pvd-order-history a.pvd-order-details:hover {
    background: rgba(0,0,0,0.06);
    text-decoration: none;
}

/* Pagination (make it match existing look roughly) */
.pvd-user-dashboard-wrapper .pvd-order-history .pvd-pagination .page-numbers {
    list-style: none;
    display: flex;
    gap: 8px;
    padding: 0;
    margin: 16px 0 0;
}

.pvd-user-dashboard-wrapper .pvd-order-history .pvd-pagination .page-numbers a.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.14);
    background: rgba(0,0,0,0.03);
    text-decoration: none;
    font-weight: 700;
}

.pvd-user-dashboard-wrapper .pvd-order-history .pvd-pagination .page-numbers a.page-numbers.current {
    background: rgba(34,113,177,0.30);
}

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

/* (moved above, enhanced) */

#pvd-profile-update-message.success { /* Updated ID */
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

#pvd-profile-update-message.error { /* Updated ID */
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}
