/* Sustainable Makers - Tech Pack Viewer & Upload Styles */

/* Modal Overlay & Container for Backoffice Tech Pack Viewer */
.tp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tp-modal-overlay.show {
    opacity: 1;
}

.tp-modal-container {
    background: #ffffff;
    width: 96vw;
    max-width: 1240px;
    max-height: 94vh;
    height: 94vh;
    border-radius: 20px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tp-modal-overlay.show .tp-modal-container {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.tp-modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafafa;
}

.tp-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tp-header-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-header-text h3 {
    margin: 0;
    font-family: var(--font-serif, 'Fraunces', serif);
    font-size: 1.25rem;
    color: #111827;
    font-weight: 700;
}

.tp-header-text p {
    margin: 2px 0 0;
    font-size: 0.8rem;
    color: #6b7280;
}

.tp-close-btn {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

.tp-close-btn:hover {
    color: #111827;
    background: #f3f4f6;
}

.tp-modal-body {
    flex: 1;
    overflow: auto;
    padding: 0;
    background: #f8fafc;
}

/* Buttons */
.tp-btn {
    padding: 9px 20px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
    border: none;
}

.tp-btn-secondary {
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
}

.tp-btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.tp-btn-primary {
    background: #059669;
    color: #ffffff;
}

.tp-btn-primary:hover {
    background: #047857;
}

/* Tech Pack Attachment Card (Spacious Two-Tier Layout) */
.techpack-attachment-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px 18px;
    margin-top: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 580px;
    width: 100%;
    box-sizing: border-box;
}

.techpack-attachment-card:hover {
    border-color: #10b981;
    box-shadow: 0 8px 24px rgba(5, 150, 105, 0.12);
}

.tp-card-top-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
}

.tp-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(5, 150, 105, 0.12);
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tp-card-info {
    flex: 1;
    min-width: 0;
}

.tp-card-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word;
}

.tp-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.76rem;
    color: #64748b;
    margin-top: 5px;
}

.tp-card-meta-badge {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
}

.tp-card-meta-size {
    color: #94a3b8;
    font-size: 0.72rem;
}

.tp-card-actions-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.tp-card-btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
    text-decoration: none;
    border: none;
    line-height: 1;
}

.tp-card-btn-view {
    background: #059669;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
    flex: 1 1 auto;
}

.tp-card-btn-view:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.35);
}

.tp-card-btn-approve {
    background: #0f172a;
    color: #ffffff;
    flex: 1 1 auto;
}

.tp-card-btn-approve:hover {
    background: #1e293b;
    transform: translateY(-1px);
}

.tp-card-approved-badge {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tp-card-btn-download {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.tp-card-btn-download:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

/* Header Techpack Button in Backoffice */
.btn-header-techpack {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.25);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-header-techpack:hover {
    background: #059669;
    color: #ffffff;
    border-color: #059669;
}

/* Single File Upload Box in Chat */
.techpack-upload-single-container {
    margin: 14px 0 6px 0;
    max-width: 580px;
    width: 100%;
    box-sizing: border-box;
}

.tp-upload-single-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.tp-upload-single-box:hover {
    border-color: #059669;
    background: rgba(5, 150, 105, 0.04);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.08);
}

.tp-upload-single-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.tp-upload-single-box:hover .tp-upload-single-icon {
    background: #059669;
    color: #ffffff;
    border-color: #059669;
}

.tp-upload-single-content {
    flex: 1;
    min-width: 0;
}

.tp-upload-single-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
}

.tp-upload-single-desc {
    font-size: 0.76rem;
    color: #64748b;
    margin-top: 2px;
}

/* Tech Pack Approval Button on Chat Card */
.tp-card-btn-approve {
    background: #059669;
    color: #ffffff;
}

.tp-card-btn-approve:hover {
    background: #047857;
    color: #ffffff;
}

.tp-card-approved-badge {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Generation In-Progress Indicator */
.tp-generation-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 18px;
    margin-top: 10px;
    max-width: 480px;
}

.tp-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #059669;
    border-radius: 50%;
    animation: tpSpin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes tpSpin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .techpack-attachment-card {
        flex-wrap: wrap;
        max-width: 100%;
    }
    .tp-card-actions {
        width: 100%;
        margin-top: 6px;
        justify-content: flex-end;
    }
    .tp-modal-container {
        max-height: 98vh;
        border-radius: 12px;
    }
    .tp-modal-header {
        padding: 12px 16px;
    }
}

/* Interactive Asset Upload Choice Container */
.asset-upload-choice-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
    margin-bottom: 6px;
    width: 100%;
    max-width: 580px;
}

.asset-upload-choice-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.asset-upload-choice-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.asset-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.asset-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.asset-card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.asset-card-subtitle {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 2px;
}

.asset-card-desc {
    font-size: 0.76rem;
    color: #475569;
    line-height: 1.4;
    margin-bottom: 14px;
    flex: 1;
}

.asset-action-btn {
    width: 100%;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
    border: none;
    text-decoration: none;
}

.asset-btn-upload {
    background: #0f172a;
    color: #ffffff;
}

.asset-btn-upload:hover {
    background: #1e293b;
    color: #ffffff;
}

.asset-btn-ai {
    background: #6366f1;
    color: #ffffff;
}

.asset-btn-ai:hover {
    background: #4f46e5;
    color: #ffffff;
}

@media (max-width: 640px) {
    .asset-upload-choice-container {
        grid-template-columns: 1fr;
    }
}

/* User Uploaded Asset Card in Chat */
.user-uploaded-asset-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    margin-top: 8px;
    max-width: 580px;
    width: 100%;
    box-sizing: border-box;
}

.user-asset-thumb-wrap {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-asset-img-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-asset-doc-icon {
    font-size: 1.4rem;
}

.user-asset-info {
    flex: 1;
    min-width: 0;
}

.user-asset-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.user-asset-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}

.user-asset-badge {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.user-asset-size {
    font-size: 0.7rem;
    color: #64748b;
}

.user-asset-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ecfdf5;
    color: #059669;
    font-size: 0.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid #a7f3d0;
}

/* Mobile Optimizations for Tech Pack Modal & Cards */
@media (max-width: 768px) {
    .tp-modal-overlay {
        padding: 8px;
    }
    .tp-modal-container {
        width: 100vw;
        height: 96vh;
        max-height: 96vh;
        border-radius: 16px;
    }
    .tp-modal-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .tp-modal-header > div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .tp-header-text h3 {
        font-size: 1.05rem;
    }
}

@media (max-width: 640px) {
    .techpack-attachment-card {
        padding: 14px;
        max-width: 100%;
    }
    .tp-card-actions-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .tp-card-btn {
        width: 100%;
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    .tp-card-approved-badge {
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }
}

/* Modal Body Scrollbar Fix - Strictly hide outer scrollbar; inner iframe handles green scrollbar */
.tp-modal-body {
    overflow: hidden !important;
}

/* Collapsible Sub-Panels (Edit Specs & AI Image Modification) */
.tp-subpanel {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s ease, opacity 0.2s ease;
    max-height: 0;
    padding: 0 24px;
    opacity: 0;
    pointer-events: none;
}

.tp-subpanel.open {
    max-height: 520px;
    padding: 16px 24px;
    opacity: 1;
    pointer-events: auto;
    overflow-y: auto;
}

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

.tp-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
}

.tp-panel-title svg {
    color: #059669;
}

/* Edit Panel Form Grid */
.tp-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.tp-form-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tp-form-group.span-2 {
    grid-column: span 2;
}

.tp-form-group.span-full {
    grid-column: 1 / -1;
}

.tp-form-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #475569;
}

.tp-form-input,
.tp-form-select,
.tp-form-textarea {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.84rem;
    color: #0f172a;
    background: #f8fafc;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}

.tp-form-input:focus,
.tp-form-select:focus,
.tp-form-textarea:focus {
    outline: none;
    border-color: #059669;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

.tp-panel-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

/* AI Prompt Panel */
.tp-prompt-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tp-prompt-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.tp-chip-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tp-chip-btn:hover {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.tp-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: tpToastIn 0.3s ease;
}

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


