/**
 * DTF Shield – Customer Portal CSS
 * Standalone page (token) + WooCommerce My Account integration.
 */

/* =========================================================================
   CSS VARIABLES
   ========================================================================= */
:root {
    --cp-primary: #009d45;
    --cp-primary-dark: #006b2d;
    --cp-approve: #28a745;
    --cp-changes: #e67e22;
    --cp-danger: #dc3545;
    --cp-info: #17a2b8;
    --cp-dark: #2d3748;
    --cp-text: #4a5568;
    --cp-muted: #718096;
    --cp-border: #e2e8f0;
    --cp-bg: #f7fafc;
    --cp-white: #ffffff;
    --cp-radius: 12px;
}

/* =========================================================================
   STANDALONE PORTAL LAYOUT (token page)
   ========================================================================= */
.dtf-cp-body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--cp-bg);
    color: var(--cp-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER */
.dtf-cp-header {
    background: linear-gradient(135deg, var(--cp-primary) 0%, var(--cp-primary-dark) 100%);
    padding: 15px 20px;
    text-align: center;
}

.dtf-cp-header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.dtf-cp-header .dtf-cp-logo {
    font-size: 28px;
}

.dtf-cp-header h1 {
    margin: 0;
    color: var(--cp-white);
    font-size: 20px;
    font-weight: 700;
}

/* MAIN */
.dtf-cp-main {
    flex: 1;
    padding: 30px 20px;
}

.dtf-cp-container {
    max-width: 700px;
    margin: 0 auto;
}

/* TITLE */
.dtf-cp-title {
    text-align: center;
    margin-bottom: 30px;
}

.dtf-cp-title h2 {
    margin: 0 0 8px 0;
    font-size: 22px;
    color: var(--cp-dark);
}

.dtf-cp-title p {
    margin: 0;
    color: var(--cp-text);
    font-size: 15px;
}

/* SPECS */
.dtf-cp-specs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
    padding: 20px;
    background: var(--cp-white);
    border-radius: var(--cp-radius);
    border: 1px solid var(--cp-border);
}

.dtf-cp-spec {
    text-align: center;
}

.dtf-cp-spec-label {
    display: block;
    font-size: 11px;
    color: var(--cp-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.dtf-cp-spec strong {
    font-size: 14px;
    color: var(--cp-dark);
}

/* RENDERS GALLERY */
.dtf-cp-renders {
    background: var(--cp-white);
    border-radius: var(--cp-radius);
    border: 1px solid var(--cp-border);
    padding: 20px;
    margin-bottom: 25px;
}

.dtf-cp-renders h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: var(--cp-dark);
}

.dtf-cp-renders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.dtf-cp-render-item {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--cp-border);
    background: #f8f9fa;
}

.dtf-cp-render-item img {
    width: 100%;
    height: auto;
    display: block;
}

.dtf-cp-file-icon {
    padding: 30px 15px;
    text-align: center;
}

.dtf-cp-file-icon span {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--cp-muted);
    margin-bottom: 8px;
}

.dtf-cp-file-icon a {
    font-size: 12px;
    color: var(--cp-primary);
}

.dtf-cp-download-wrap {
    text-align: center;
    padding-top: 10px;
}

/* BUTTONS */
.dtf-cp-btn {
    display: inline-block;
    padding: 14px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.dtf-cp-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dtf-cp-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.dtf-cp-btn-approve {
    background: var(--cp-approve);
    color: var(--cp-white);
}

.dtf-cp-btn-approve:hover {
    background: #218838;
}

.dtf-cp-btn-changes {
    background: var(--cp-changes);
    color: var(--cp-white);
}

.dtf-cp-btn-changes:hover {
    background: #d35400;
}

.dtf-cp-btn-secondary {
    background: var(--cp-white);
    color: var(--cp-dark);
    border: 1px solid var(--cp-border);
}

.dtf-cp-btn-secondary:hover {
    background: #f1f5f9;
}

/* ACTIONS */
.dtf-cp-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 25px;
}

.dtf-cp-actions .dtf-cp-btn {
    flex: 1;
    max-width: 250px;
}

/* CHANGES FORM */
.dtf-cp-changes-form {
    background: var(--cp-white);
    border-radius: var(--cp-radius);
    border: 1px solid var(--cp-border);
    padding: 25px;
    margin-bottom: 25px;
}

.dtf-cp-changes-form h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: var(--cp-dark);
}

.dtf-cp-changes-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--cp-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.dtf-cp-changes-form textarea:focus {
    outline: none;
    border-color: var(--cp-primary);
    box-shadow: 0 0 0 3px rgba(0, 157, 69, 0.1);
}

.dtf-cp-change-file {
    margin-bottom: 15px;
}

.dtf-cp-change-file label {
    display: block;
    font-size: 13px;
    color: var(--cp-muted);
    margin-bottom: 6px;
}

.dtf-cp-change-file input[type="file"] {
    font-size: 13px;
}

.dtf-cp-changes-btns {
    display: flex;
    gap: 10px;
}

/* SUCCESS MESSAGES */
.dtf-cp-success,
.dtf-cp-approved-msg {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    border-radius: var(--cp-radius);
    padding: 30px;
    text-align: center;
    margin-bottom: 25px;
}

.dtf-cp-success-changes {
    background: #fef3e2;
    border-color: #fde68a;
}

.dtf-cp-approved-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.dtf-cp-success h3,
.dtf-cp-approved-msg h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: var(--cp-dark);
}

.dtf-cp-success p,
.dtf-cp-approved-msg p {
    margin: 0;
    color: var(--cp-text);
    font-size: 14px;
    line-height: 1.6;
}

/* EXPIRED PAGE */
.dtf-cp-expired {
    text-align: center;
    padding: 50px 20px;
}

.dtf-cp-expired-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.dtf-cp-expired h2 {
    margin: 0 0 15px 0;
    font-size: 24px;
    color: var(--cp-dark);
}

.dtf-cp-expired p {
    margin: 0 0 20px 0;
    color: var(--cp-text);
    font-size: 15px;
    line-height: 1.6;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.dtf-cp-expired-contact {
    margin-bottom: 25px;
}

.dtf-cp-expired-contact a {
    color: var(--cp-primary);
}

/* FOOTER */
.dtf-cp-footer {
    text-align: center;
    padding: 15px 20px;
    border-top: 1px solid var(--cp-border);
}

.dtf-cp-footer p {
    margin: 0;
    color: var(--cp-muted);
    font-size: 12px;
}

.dtf-cp-expires {
    color: var(--cp-changes) !important;
    font-weight: 500;
    margin-bottom: 5px !important;
}

/* =========================================================================
   MY ACCOUNT INTEGRATION
   ========================================================================= */

/* LIST VIEW */
.dtf-ma-shields {
    margin: 0;
}

.dtf-ma-title {
    margin: 0 0 20px 0;
    font-size: 20px;
}

.dtf-ma-empty {
    color: var(--cp-muted);
    font-style: italic;
}

.dtf-ma-table {
    width: 100%;
    border-collapse: collapse;
}

.dtf-ma-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--cp-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--cp-border);
}

.dtf-ma-table td {
    padding: 12px;
    border-bottom: 1px solid var(--cp-border);
    font-size: 14px;
}

.dtf-ma-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    color: var(--cp-white);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dtf-ma-view-btn {
    font-size: 13px !important;
    padding: 6px 16px !important;
}

.dtf-ma-no-renders {
    color: var(--cp-muted);
    font-size: 12px;
    font-style: italic;
}

/* DETAIL VIEW */
.dtf-ma-shield-detail {
    margin: 0;
}

.dtf-ma-back a {
    color: var(--cp-primary);
    text-decoration: none;
    font-size: 14px;
}

.dtf-ma-back a:hover {
    text-decoration: underline;
}

.dtf-ma-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.dtf-ma-detail-header h3 {
    margin: 0;
    font-size: 20px;
}

.dtf-ma-approved-msg {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.dtf-ma-approved-msg p {
    margin: 0;
    color: var(--cp-approve);
    font-weight: 600;
    font-size: 14px;
}

.dtf-ma-specs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid var(--cp-border);
}

.dtf-ma-spec {
    text-align: center;
}

.dtf-ma-spec span {
    display: block;
    font-size: 11px;
    color: var(--cp-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.dtf-ma-spec strong {
    font-size: 13px;
    color: var(--cp-dark);
}

/* RENDERS */
.dtf-ma-renders {
    margin-bottom: 25px;
}

.dtf-ma-renders h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
}

.dtf-ma-renders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.dtf-ma-render-item {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--cp-border);
}

.dtf-ma-render-item img {
    width: 100%;
    height: auto;
    display: block;
}

.dtf-ma-file-icon {
    padding: 25px;
    text-align: center;
    background: #f8f9fa;
}

.dtf-ma-file-icon span {
    font-size: 20px;
    font-weight: 700;
    color: var(--cp-muted);
}

.dtf-ma-download {
    margin-top: 10px;
}

/* ACTIONS */
.dtf-ma-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.dtf-ma-btn-approve {
    background: var(--cp-approve) !important;
    color: var(--cp-white) !important;
    border-color: var(--cp-approve) !important;
}

.dtf-ma-btn-approve:hover {
    background: #218838 !important;
}

.dtf-ma-btn-changes {
    background: var(--cp-changes) !important;
    color: var(--cp-white) !important;
    border-color: var(--cp-changes) !important;
}

.dtf-ma-btn-changes:hover {
    background: #d35400 !important;
}

/* CHANGES FORM */
.dtf-ma-changes-form {
    background: #f8f9fa;
    border: 1px solid var(--cp-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.dtf-ma-changes-form h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
}

.dtf-ma-changes-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--cp-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.dtf-ma-change-file {
    margin-bottom: 12px;
}

.dtf-ma-change-file label {
    display: block;
    font-size: 13px;
    color: var(--cp-muted);
    margin-bottom: 5px;
}

.dtf-ma-changes-btns {
    display: flex;
    gap: 10px;
}

/* RENDER GROUPS (My Account) */
.dtf-ma-renders {
    margin-bottom: 25px;
}

.dtf-ma-render-group {
    margin-bottom: 20px;
}

.dtf-ma-render-group-header {
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: inline-block;
}

.dtf-ma-render-group-latest .dtf-ma-render-group-header {
    background: #e6f9ee;
    color: var(--cp-primary);
    border: 1px solid #c6f6d5;
}

.dtf-ma-render-group-old .dtf-ma-render-group-header {
    background: #f0f4f8;
    color: var(--cp-muted);
    border: 1px solid var(--cp-border);
}

/* COMMUNICATION TIMELINE */
.dtf-ma-timeline {
    margin-bottom: 25px;
}

.dtf-ma-timeline h4 {
    margin: 0 0 14px 0;
    font-size: 16px;
    color: var(--cp-dark);
}

.dtf-ma-timeline-item {
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

/* Operator messages — green/blue */
.dtf-ma-timeline-operator {
    background: #f0f9f4;
    border: 1px solid #c6f6d5;
    border-left: 4px solid var(--cp-primary);
}

/* Customer messages — orange */
.dtf-ma-timeline-customer {
    background: #fff8f0;
    border: 1px solid #fde8d0;
    border-left: 4px solid var(--cp-changes);
}

.dtf-ma-timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.dtf-ma-timeline-label {
    font-size: 12px;
    font-weight: 700;
}

.dtf-ma-timeline-label-op {
    color: var(--cp-primary);
}

.dtf-ma-timeline-label-cu {
    color: var(--cp-changes);
}

.dtf-ma-timeline-date {
    font-size: 11px;
    color: var(--cp-muted);
}

.dtf-ma-timeline-envio-op {
    font-size: 10px;
    background: var(--cp-primary);
    color: var(--cp-white);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.dtf-ma-timeline-envio-cu {
    font-size: 10px;
    background: var(--cp-changes);
    color: var(--cp-white);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.dtf-ma-timeline-attachment {
    font-size: 12px;
    color: var(--cp-muted);
}

.dtf-ma-timeline-msg {
    font-size: 14px;
    color: var(--cp-dark);
    line-height: 1.6;
    white-space: pre-line;
}

.dtf-ma-timeline-msg-auto {
    color: var(--cp-muted);
    font-style: italic;
}

/* FILES CLEANED */
.dtf-ma-files-cleaned {
    background: #f7fafc;
    border: 1px solid var(--cp-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.dtf-ma-files-cleaned p {
    margin: 0;
    color: var(--cp-text);
    font-size: 14px;
    line-height: 1.6;
}

/* SUCCESS */
.dtf-ma-success {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.dtf-ma-success p {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
    color: var(--cp-approve);
}

.dtf-ma-success-changes {
    background: #fef3e2;
    border-color: #fde68a;
}

.dtf-ma-success-changes p {
    color: var(--cp-changes);
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 600px) {
    .dtf-cp-specs {
        grid-template-columns: repeat(2, 1fr);
    }

    .dtf-cp-renders-grid {
        grid-template-columns: 1fr;
    }

    .dtf-cp-actions {
        flex-direction: column;
    }

    .dtf-cp-actions .dtf-cp-btn {
        max-width: none;
    }

    .dtf-cp-title h2 {
        font-size: 18px;
    }

    .dtf-ma-specs {
        grid-template-columns: repeat(2, 1fr);
    }

    .dtf-ma-renders-grid {
        grid-template-columns: 1fr;
    }

    .dtf-ma-actions {
        flex-direction: column;
    }

    .dtf-ma-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Responsive table for My Account list */
    .dtf-ma-table thead {
        display: none;
    }

    .dtf-ma-table tr {
        display: block;
        margin-bottom: 15px;
        background: var(--cp-white);
        border: 1px solid var(--cp-border);
        border-radius: 8px;
        padding: 12px;
    }

    .dtf-ma-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: none;
    }

    .dtf-ma-table td::before {
        content: attr(data-title);
        font-weight: 600;
        font-size: 12px;
        color: var(--cp-muted);
        text-transform: uppercase;
    }
}

/* ---------- CUSTOMER PORTAL — renders grouped by Envío ---------- */
.dtf-cp-envio-group {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--cp-border);
}

.dtf-cp-envio-group:last-child {
    margin-bottom: 0;
}

.dtf-cp-envio-history {
    opacity: 0.72;
}

.dtf-cp-envio-history .dtf-cp-envio-header {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    color: #777;
}

.dtf-cp-envio-latest .dtf-cp-envio-header {
    background: linear-gradient(135deg, #009d45, #006b2d);
    color: #fff;
}

.dtf-cp-envio-header {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.dtf-cp-op-message {
    background: #f0faf4;
    border-bottom: 1px solid #c6e8d4;
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dtf-cp-op-message-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #006b2d;
}

.dtf-cp-op-message-text {
    font-size: 14px;
    color: #2d5a3d;
    line-height: 1.6;
    font-style: italic;
}

.dtf-cp-envio-group .dtf-cp-renders-grid {
    padding: 14px 18px;
    border-bottom: 1px solid var(--cp-border);
}

.dtf-cp-envio-group .dtf-cp-download-wrap {
    padding: 12px 18px;
    background: #fafafa;
}

.dtf-cp-envio-history .dtf-cp-renders-grid img {
    filter: grayscale(0.3);
}
