/**
 * SouthWood PM Dashboard - Project Details Styles
 * Enhanced modal with tabbed interface and drill-down views
 */

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    backdrop-filter: blur(2px);
}

/* Modal Container */
.project-detail-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: var(--primary-teal);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-left h2 {
    margin: 0;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left .project-customer {
    margin: 5px 0 0 0;
    opacity: 0.9;
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Tabs */
.detail-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    padding: 0 20px;
    overflow-x: auto;
}

.detail-tab {
    background: none;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
}

.detail-tab:hover {
    color: var(--primary-teal);
    background: rgba(0, 122, 120, 0.05);
}

.detail-tab.active {
    color: var(--primary-teal);
    border-bottom-color: var(--primary-teal);
}

/* Tab Content */
.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: white;
}

/* Overview Grid */
.overview-grid {
    display: grid;
    gap: 25px;
}

.metric-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.metric-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.metric-card i {
    font-size: 28px;
    color: var(--primary-teal);
    margin-bottom: 10px;
}

.metric-value {
    font-size: 32px;
    font-weight: bold;
    color: #333;
    margin: 10px 0;
}

.metric-value.success { color: var(--success-green); }
.metric-value.warning { color: var(--warning-yellow); }
.metric-value.danger { color: var(--alert-red); }

.metric-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success-green);
    transition: width 0.3s;
}

/* Info Section */
.info-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.info-section h3 {
    margin: 0 0 20px 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
}

.info-item value {
    font-size: 15px;
    color: #333;
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-item i {
    font-size: 32px;
    color: var(--light-teal);
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.stat-label {
    font-size: 12px;
    color: #666;
}

/* Orders & Jobs */
.orders-container h3 {
    margin: 0 0 20px 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.3s;
}

.order-item.expanded {
    border-color: var(--primary-teal);
}

.order-header {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    transition: background 0.2s;
}

.order-header:hover {
    background: #e9ecef;
}

.order-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.order-info i.fa-chevron-right,
.order-info i.fa-chevron-down {
    color: var(--primary-teal);
    transition: transform 0.3s;
}

.order-amount {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-teal);
}

.order-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #666;
}

.order-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Jobs */
.jobs-container {
    padding: 15px;
    background: white;
}

.job-item {
    border-left: 3px solid #e0e0e0;
    padding: 12px 15px;
    margin: 8px 0;
    background: #f8f9fa;
    border-radius: 4px;
    transition: all 0.3s;
}

.job-item.expanded {
    border-left-color: var(--light-teal);
    background: white;
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.job-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.job-info i.fa-chevron-right,
.job-info i.fa-chevron-down {
    color: var(--light-teal);
    font-size: 12px;
}

.job-desc {
    color: #666;
}

.job-cost {
    font-weight: 600;
    color: #333;
}

.job-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar-small {
    width: 80px;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

/* Line Items Table */
.line-items-container {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 4px;
}

.line-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.line-items-table th {
    background: #f8f9fa;
    padding: 10px;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
}

.line-items-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.line-items-table tbody tr:hover {
    background: #f8f9fa;
}

/* Documents */
.documents-container {
    max-width: 900px;
}

.documents-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.documents-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.folders-grid {
    display: grid;
    gap: 15px;
}

.folder-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

.folder-item.expanded {
    border-color: var(--light-teal);
}

.folder-header {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    background: #f8f9fa;
    transition: background 0.2s;
}

.folder-header:hover {
    background: #e9ecef;
}

.folder-header i.fa-folder,
.folder-header i.fa-folder-open {
    font-size: 24px;
    color: var(--light-teal);
}

.folder-header strong {
    flex: 1;
    font-size: 16px;
}

.file-count {
    font-size: 13px;
    color: #666;
    background: white;
    padding: 4px 12px;
    border-radius: 12px;
}

.folder-header .chevron {
    color: #999;
    font-size: 14px;
}

/* Files List */
.files-list {
    padding: 15px;
    background: white;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.file-item:hover {
    background: #f8f9fa;
}

.file-item i.fa-file-pdf { color: #e74c3c; }
.file-item i.fa-file-image { color: #3498db; }
.file-item i.fa-file-word { color: #2c3e50; }
.file-item i.fa-file-excel { color: #27ae60; }
.file-item i.fa-file-lines { color: #f39c12; }

.file-item i {
    font-size: 24px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 3px;
}

.file-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 15px;
}

.btn-icon {
    background: none;
    border: 1px solid #e0e0e0;
    color: #666;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--light-teal);
    color: white;
    border-color: var(--light-teal);
}

/* Timeline */
.timeline-container h3 {
    margin: 0 0 30px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e0e0e0;
}

.timeline-event {
    position: relative;
    margin-bottom: 25px;
    display: flex;
    gap: 20px;
}

.timeline-marker {
    position: absolute;
    left: -25px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    font-size: 14px;
}

.timeline-marker.primary {
    background: var(--primary-teal);
    color: white;
}

.timeline-marker.success {
    background: var(--success-green);
    color: white;
}

.timeline-marker.warning {
    background: var(--warning-yellow);
    color: white;
}

.timeline-marker.info {
    background: var(--light-teal);
    color: white;
}

.timeline-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    flex: 1;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.timeline-header strong {
    color: #333;
}

.timeline-time {
    font-size: 12px;
    color: #999;
}

.timeline-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #666;
}

.timeline-user,
.timeline-type {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Team */
.team-container h3 {
    margin: 0 0 25px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.team-member-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.member-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--light-teal);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.member-info strong {
    display: block;
    font-size: 16px;
    color: #333;
}

.member-role {
    font-size: 13px;
    color: #666;
}

.member-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.stat-row span {
    min-width: 80px;
    color: #666;
}

.capacity-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.capacity-fill {
    height: 100%;
    transition: width 0.3s;
}

.capacity-fill.success { background: var(--success-green); }
.capacity-fill.warning { background: var(--warning-yellow); }
.capacity-fill.danger { background: var(--alert-red); }

/* Financials */
.financials-container h3,
.financials-container h4 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.financial-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.financial-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.financial-card label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.financial-card value.large {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.costs-section,
.invoices-section,
.change-orders-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.cost-breakdown {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cost-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cost-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cost-bar {
    position: relative;
    width: 100%;
    height: 24px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.cost-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--light-teal);
}

.cost-bar span {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

/* Invoices Table */
.invoices-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.invoices-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
}

.invoices-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.invoices-table tbody tr:hover {
    background: #f8f9fa;
}

/* Change Orders */
.change-orders-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.change-order-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.co-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.co-amount {
    font-size: 18px;
    font-weight: bold;
}

.co-amount.positive { color: var(--success-green); }
.co-amount.negative { color: var(--alert-red); }

.co-details p {
    margin: 0 0 10px 0;
    color: #666;
}

.co-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #666;
}

.co-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    margin-bottom: 20px;
}

.empty-state p {
    margin: 15px 0 25px 0;
    font-size: 16px;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #e3f2fd;
    color: #1976d2;
}

.status-pending {
    background: #fff3e0;
    color: #f57c00;
}

.status-completed {
    background: #e8f5e9;
    color: #388e3c;
}

.status-on-hold {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-teal);
    color: white;
}

.btn-primary:hover {
    background: #006664;
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--primary-teal);
    border: 2px solid var(--primary-teal);
}

.btn-secondary:hover {
    background: var(--primary-teal);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .project-detail-modal {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .metric-cards,
    .financial-cards,
    .team-grid {
        grid-template-columns: 1fr;
    }

    .detail-content {
        padding: 20px;
    }

    .order-header,
    .cost-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
