/**
 * Project Detail Page Styles
 */

.project-detail {
    padding: var(--space-lg);
    max-width: 1400px;
    margin: 0 auto;
}

/* Back to Dashboard */
.project-back-bar {
    margin-bottom: var(--space-md);
}
.back-to-dashboard {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.back-to-dashboard:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* Header */
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-lg);
}

.project-header-info .project-code {
    font-family: monospace;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.project-header-info .project-title {
    margin: var(--space-xs) 0;
    font-size: 1.75rem;
}

.project-client-info {
    display: flex;
    gap: var(--space-md);
    color: var(--text-secondary);
}

.project-value {
    text-align: right;
}

.project-value .value-label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.project-value .value-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

/* Stage Pipeline */
.stage-pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: var(--space-xl);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow-x: auto;
}

.stage-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 100px;
    padding: var(--space-sm);
    cursor: pointer;
    position: relative;
}

.stage-step::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.stage-step:last-child::after {
    display: none;
}

.stage-step.completed::after {
    background: var(--stage-color);
}

.stage-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    position: relative;
    z-index: 1;
    transition: all 0.2s;
}

.stage-step.completed .stage-dot {
    background: var(--stage-color);
    border-color: var(--stage-color);
}

.stage-step.active .stage-dot {
    background: var(--stage-color);
    border-color: var(--stage-color);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.2);
    transform: scale(1.3);
}

.stage-label {
    margin-top: var(--space-sm);
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}

.stage-step.active .stage-label,
.stage-step.completed .stage-label {
    color: var(--text-primary);
    font-weight: 500;
}

.stage-step:hover .stage-dot {
    border-color: var(--stage-color);
}

/* Content Grid */
.project-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: var(--space-lg);
}

@media (max-width: 1024px) {
    .project-content {
        grid-template-columns: 1fr;
    }
}

.project-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.project-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

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

.card-header h3 {
    margin: 0;
    font-size: 1rem;
}

.card-body {
    padding: var(--space-md);
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-item span,
.detail-item p {
    margin: 0;
}

.detail-item em {
    color: var(--text-secondary);
}

.unassigned {
    color: var(--warning);
}

/* Task list in project */
.project-detail .task-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.project-detail .task-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.project-detail .task-item.completed {
    opacity: 0.5;
}

.project-detail .task-item.completed .task-title {
    text-decoration: line-through;
}

.project-detail .task-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.project-detail .task-assignee {
    font-size: 11px;
    color: var(--text-secondary);
}

.project-detail .task-due {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Document list */
.document-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.document-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.15s;
}

.document-item:hover {
    background: var(--bg-hover);
}

.doc-icon {
    font-size: 1.25rem;
}

.doc-name {
    flex: 1;
    font-weight: 500;
}

.doc-type {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
}

/* Action buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.btn-block {
    width: 100%;
}

/* Activity Timeline */
.activity-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.activity-item {
    display: flex;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    margin-top: 5px;
    flex-shrink: 0;
}

.activity-content {
    display: flex;
    flex-direction: column;
}

.activity-action {
    color: var(--text-primary);
}

.activity-user {
    font-size: 11px;
    color: var(--text-secondary);
}

.activity-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.no-items {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: var(--space-md);
}

/* Buttons */
.btn-tiny {
    padding: 2px 8px;
    font-size: 11px;
}

/* Header actions */
.header-actions {
    display: flex;
    gap: var(--space-xs);
}

/* Document items with share button */
.document-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    transition: background 0.15s;
}

.document-item .doc-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    text-decoration: none;
    color: var(--text-primary);
}

.document-item:hover {
    background: var(--bg-hover);
}

.doc-share-btn {
    opacity: 0;
    transition: opacity 0.15s;
}

.document-item:hover .doc-share-btn {
    opacity: 1;
}

/* Form hints */
.form-hint {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}

/* Share modal */
.share-doc-name {
    font-weight: 500;
    margin-bottom: var(--space-md);
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.current-shares {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.current-shares label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    display: block;
    margin-bottom: var(--space-xs);
}

.shares-list {
    font-size: var(--font-size-sm);
}

.share-item {
    padding: 4px 0;
}

/* Media Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.media-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: transform 0.15s, box-shadow 0.15s;
}

.media-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.media-link {
    display: block;
    width: 100%;
}

.media-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-secondary);
}

.media-name {
    font-size: 11px;
    color: var(--text-primary);
    margin-top: 6px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.media-source {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Project detail header actions (wider button) */
.project-header .project-actions {
    width: auto;
    min-width: 180px;
}

.project-header .project-actions .btn {
    white-space: nowrap;
}

/* Media remove button */
.media-item {
    position: relative;
}

.media-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.media-item:hover .media-remove {
    opacity: 1;
}

.media-remove:hover {
    background: #c82333;
}

/* Document remove button */
.document-item {
    position: relative;
}

.doc-remove-btn {
    color: #dc3545 !important;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.document-item:hover .doc-remove-btn {
    opacity: 1;
}

.doc-remove-btn:hover {
    background: rgba(220, 53, 69, 0.1) !important;
}

/* Document from task indicator */
.doc-from-task {
    background: #e3f2fd;
    color: #1565c0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Task attachment button */
.project-detail .task-item .task-attach-btn {
    padding: 4px 8px;
    font-size: 0.9rem;
    opacity: 0.7;
    border: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
}

.project-detail .task-item .task-attach-btn:hover {
    opacity: 1;
    background: #e9ecef;
}

.task-docs-count {
    font-size: 0.7rem;
    color: #666;
    margin-left: 4px;
}

/* Designs Grid */
#designsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.design-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.design-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.design-thumbnails {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 8px;
}

.design-thumbnail {
    flex: 1;
    aspect-ratio: 2;       /* design thumbs are always 2:1 — landscape */
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-height: 140px;
}

.design-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.design-info {
    padding: 8px;
}

.design-title {
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.design-meta {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.design-product {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

.design-colors {
    color: var(--text-secondary);
}

/* Quote Builder Styles */
.quote-builder {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.quote-info {
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.quote-items-header {
    display: grid;
    grid-template-columns: 2fr 80px 100px 100px 40px;
    gap: var(--space-sm);
    padding: var(--space-sm);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.quote-item-row {
    display: grid;
    grid-template-columns: 2fr 80px 100px 100px 40px;
    gap: var(--space-sm);
    padding: var(--space-sm);
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.quote-item-qty {
    width: 70px;
    text-align: center;
}

.quote-item-remove {
    padding: 4px 8px;
}

.quote-totals {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 2px solid var(--border-color);
}

.quote-total-row {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-xs) 0;
    align-items: center;
}

.quote-total-row.total {
    font-weight: 700;
    font-size: var(--font-size-lg);
}

.no-items {
    text-align: center;
    color: var(--text-secondary);
    padding: var(--space-lg);
}

/* Product Picker Grid */
.product-picker-search {
    margin-bottom: var(--space-md);
}

.product-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-md);
    max-height: 400px;
    overflow-y: auto;
}

.product-picker-item {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--space-sm);
    cursor: pointer;
    transition: border-color 0.2s;
}

.product-picker-item:hover {
    border-color: var(--accent);
}

.product-picker-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
}

.product-picker-info {
    margin-top: var(--space-xs);
}

.product-picker-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-picker-price {
    color: var(--accent);
    font-weight: 600;
}

.modal-large {
    max-width: 800px;
    width: 90%;
}

.quote-item-price-input {
    width: 90px;
    text-align: right;
}

.product-picker-sku {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Quotes List on Project Page */
.quotes-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.quote-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.2s;
}

.quote-item:hover {
    background: var(--bg-secondary);
}

.quote-main {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.quote-code {
    font-weight: 600;
    font-family: monospace;
}

.quote-version {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

.quote-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: 500;
}

.quote-status.status-draft { background: var(--bg-secondary); color: var(--text-secondary); }
.quote-status.status-sent { background: #fff3cd; color: #856404; }
.quote-status.status-accepted { background: #d4edda; color: #155724; }
.quote-status.status-declined { background: #f8d7da; color: #721c24; }

.quote-details {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.quote-amount {
    font-weight: 600;
    font-family: monospace;
}

.quote-date {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Quote Designs Section */
.quote-designs-section {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.quote-designs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.quote-designs-header label {
    font-weight: 600;
}

.quote-designs-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.quote-design-card {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.quote-design-thumb {
    width: 60px;
    height: 30px;          /* design thumbs are always 2:1 */
    border-radius: 4px;
    overflow: hidden;
}

.quote-design-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quote-design-info {
    max-width: 120px;
}

.quote-design-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quote-design-remove {
    padding: 2px 6px !important;
    font-size: 14px !important;
}

/* Design Picker Grid */
/* ── Design Picker (Quote modal) ────────────────────────────────────────── */

.design-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
    padding: var(--space-sm);
}

/* Card — mirrors .design-version-thumb exactly */
.design-picker-item {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    position: relative;
}

.design-picker-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    border-color: var(--accent, #4f46e5);
}

/* Image area — 2:1 ratio, same as .dvt-image */
.design-picker-item .dvt-image img {
    transition: transform 0.2s;
}

.design-picker-item:hover .dvt-image img {
    transform: scale(1.04);
}

/* Multi-select hint */
.picker-hint {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: var(--space-sm);
}

/* Selection checkmark overlay — sits in the image area top-right */
.design-picker-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: var(--accent, #4f46e5);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 900;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 2;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    pointer-events: none;
}

.design-picker-item.selected {
    border-color: var(--accent, #4f46e5);
}

.design-picker-item.selected .design-picker-check {
    opacity: 1;
    transform: scale(1);
}

/* ── Design Versions Gallery ────────────────────────────────────────────── */

.design-versions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

/* Each thumbnail is an <a> tag — opens image in new tab */
.design-version-thumb {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    cursor: pointer;
}

.design-version-thumb:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    border-color: var(--accent, #4f46e5);
}

/* Image area with badge overlays */
.dvt-image {
    position: relative;
    width: 100%;
    aspect-ratio: 2;
    background: var(--bg-secondary, #f3f4f6);
    overflow: hidden;
}

.dvt-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.design-version-thumb:hover .dvt-image img {
    transform: scale(1.04);
}

/* Version badge — inline in meta */
.dvt-version-badge {
    background: var(--bg-tertiary, #e5e7eb);
    color: var(--text-primary, #374151);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

/* Approved checkmark — top-right */
.dvt-approved-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #16a34a;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* Approved thumbnail gets a green border tint */
.design-version-thumb.is-approved {
    border-color: #86efac;
}

/* Meta row under the image */
.dvt-meta {
    padding: 6px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.dvt-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dvt-date {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
}

.dvt-notes {
    font-size: 11px;
    color: var(--text-muted, #9ca3af);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* "No designs" empty state */
.design-versions-empty {
    color: var(--text-secondary, #6b7280);
    font-size: 13px;
    font-style: italic;
    padding: 4px 0;
}
