/* Customer Communication Portal - Frontend Styles */

/* Global image constraints for portal */
.cc-portal-container img:not(.file-preview img) {
    max-width: 100%;
    height: auto;
}

.cc-portal-container .file-preview img {
    max-width: 60px !important;
    max-height: 60px !important;
    width: 60px !important;
    height: 60px !important;
}

/* Main Portal Container */
.cc-portal-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Portal Header */
.cc-portal-header {
    border-bottom: 2px solid #007cba;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.cc-portal-header h2 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 28px;
    font-weight: 600;
}

.project-info {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.project-order {
    color: #666;
    font-weight: 500;
}

.project-products {
    color: #444;
    font-weight: 500;
    padding: 4px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.project-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-status.status-active {
    background: #d1ecf1;
    color: #0c5460;
}

.project-status.status-completed {
    background: #d4edda;
    color: #155724;
}

.project-status.status-on_hold {
    background: #fff3cd;
    color: #856404;
}

/* Product Information */
.project-product-details {
    margin: 20px 0;
    padding: 20px;
    background: #f1f3f4;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

.project-product-details h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.product-details-content {
    color: #555;
    line-height: 1.6;
}

/* Project Description */
.project-description {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007cba;
}

.project-description h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.description-content {
    color: #666;
    line-height: 1.6;
}

/* Portal Content Layout */
.cc-portal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .cc-portal-content {
        grid-template-columns: 1fr;
    }
}

.portal-column {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.portal-column h3 {
    margin: 0;
    padding: 20px;
    background: #f8f9fa;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

/* File Upload Section */
.upload-section {
    padding: 20px;
}

.upload-area {
    border: 2px dashed #007cba;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #005a87;
    background: #e3f2fd;
}

.upload-content h4 {
    margin: 10px 0;
    color: #333;
    font-size: 18px;
}

.upload-content p {
    margin: 10px 0;
    color: #666;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

#file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #007cba;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

.upload-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.file-requirements {
    margin: 0;
    font-size: 12px;
    color: #999;
    text-align: center;
}

/* Files List */
.files-list {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #fff;
    transition: all 0.3s ease;
    min-height: 80px;
}

.file-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.file-preview {
    width: 60px !important;
    height: 60px !important;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.file-preview img,
.cc-portal-container .file-preview img,
.file-item .file-preview img {
    width: 60px !important;
    height: 60px !important;
    max-width: 60px !important;
    max-height: 60px !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.file-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.file-extension {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-align: center;
    line-height: 1;
}
    object-fit: cover;
}

.file-icon {
    font-size: 24px;
}

.file-info {
    flex: 1;
}

.file-name a {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
}

.file-name a:hover {
    text-decoration: underline;
}

.file-meta {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.file-actions {
    display: block;
    width: 100%;
    text-align: right;
    padding: 5px 0;
}

/* File Actions Container */
.file-actions {
    display: block;
    width: 100%;
    text-align: right;
    padding: 5px 0;
}

/* Delete Button */
.delete-file-btn {
    display: inline-block;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: normal;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    background-color: #f8f9fa;
    background-image: none;
    color: #dc3545;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    min-width: 50px;
    min-height: 28px;
}

/* Hover and Focus States */
.delete-file-btn:hover,
.delete-file-btn:focus {
    background-color: #c82333 !important;
    border-color: #bd2130 !important;
    color: white !important;
    text-decoration: none !important;
}

/* Active State */
.delete-file-btn:active {
    background-color: #bd2130 !important;
    border-color: #b21f2d !important;
}

.delete-file-btn:hover,
button.delete-file-btn:hover {
    background-color: #ffe6e6;
    border-color: #dc3545;
    color: #dc3545;
}

.no-files {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px 20px;
}

/* Notes Section */
.notes-list {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.note-item {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    position: relative;
}

.note-item.customer {
    background: #e3f2fd;
    border-left: 4px solid #007cba;
    margin-right: 20px;
}

.note-item.admin {
    background: #f3e5f5;
    border-left: 4px solid #9c27b0;
    margin-left: 20px;
}

.note-item.private {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
}

.note-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #666;
}

.note-author {
    font-weight: 600;
    color: #333;
}

.note-type {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.private-badge {
    background: #ff9800;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.note-date {
    margin-left: auto;
}

.note-content {
    color: #333;
    line-height: 1.6;
}

.note-content p {
    margin: 0 0 10px 0;
}

.note-content p:last-child {
    margin-bottom: 0;
}

.no-notes {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px 20px;
}

/* Add Note Form */
.add-note-section {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.note-form .form-group {
    margin-bottom: 15px;
}

.note-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.note-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
}

.note-form textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

/* Buttons */
.button,
.cc-portal-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.button:hover,
.cc-portal-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.button.button-small {
    padding: 8px 16px;
    font-size: 12px;
}

.button.button-secondary {
    background: #6c757d;
}

.button.button-secondary:hover {
    background: #545b62;
}

/* Dashboard Widget */
.cc-portal-dashboard-widget {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.cc-portal-dashboard-widget h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007cba;
}

.projects-list {
    margin-bottom: 20px;
}

.project-item {
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.project-item:last-child {
    border-bottom: none;
}

.project-item h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.project-item h4 a {
    color: #007cba;
    text-decoration: none;
}

.project-item h4 a:hover {
    text-decoration: underline;
}

.project-meta {
    margin: 0;
    font-size: 12px;
    color: #999;
}

.view-all-projects {
    text-align: center;
    margin: 0;
}

/* Order Portal Link */
.cc-portal-order-link {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.cc-portal-order-link h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
}

.cc-portal-order-link p {
    margin: 0 0 15px 0;
    color: #666;
}

/* Loading and Error States */
.cc-portal-loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

.cc-portal-error {
    padding: 15px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 10px 0;
}

.cc-portal-success {
    padding: 15px;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    margin: 10px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cc-portal-container {
        padding: 15px;
        margin: 10px;
    }
    
    .cc-portal-header h2 {
        font-size: 24px;
    }
    
    .project-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .file-item {
        flex-direction: column;
        text-align: center;
    }
    
    .file-preview {
        width: 80px;
        height: 80px;
    }
    
    .note-item.customer {
        margin-right: 0;
    }
    
    .note-item.admin {
        margin-left: 0;
    }
    
    .note-header {
        flex-wrap: wrap;
    }
}

/* Clickable Links in Notes */
.note-content a {
    color: #0073aa;
    text-decoration: underline;
    word-break: break-all;
}

.note-content a:hover {
    color: #005a87;
    text-decoration: none;
}

.note-content a:visited {
    color: #4c1130;
}

/* Print Styles */
@media print {
    .upload-section,
    .add-note-section,
    .file-actions,
    .cc-portal-btn,
    .button {
        display: none !important;
    }
    
    .cc-portal-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}