/* assets/css/frontend.css */

.wdcp-portal {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Header Styles */
.wdcp-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.wdcp-header h2 {
    margin: 0 0 20px 0;
    font-size: 28px;
    font-weight: 300;
}

.wdcp-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wdcp-tab-btn {
    padding: 12px 24px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.wdcp-tab-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.wdcp-tab-btn.active {
    background: white;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Tab Content */
.wdcp-tab-content {
    display: none;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e8ecef;
}

.wdcp-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* Overview Tab */
.wdcp-overview {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.wdcp-projects-section h3,
.wdcp-recent-activity h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}

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

.wdcp-project-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.wdcp-project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.wdcp-project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.wdcp-project-card h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.project-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 14px;
    color: #6c757d;
}

.project-progress {
    margin-top: 15px;
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 10px;
    transition: width 0.6s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Recent Activity */
.activity-list {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.activity-item:last-child {
    border-bottom: none;
}

/* Messaging Styles */
.wdcp-messaging {
    max-width: 100%;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.message-header h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.project-selector {
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    min-width: 200px;
    transition: border-color 0.3s ease;
}

.project-selector:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.message-thread {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    max-height: 450px;
    overflow-y: auto;
    min-height: 200px;
}

.message-item {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-left: 4px solid #667eea;
}

.message-item.from-client {
    border-left-color: #28a745;
    margin-left: 20px;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
    color: #6c757d;
}

.message-author {
    font-weight: 600;
    color: #2c3e50;
}

.message-content {
    line-height: 1.6;
    color: #495057;
}

.message-composer {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.message-composer textarea {
    width: 100%;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.3s ease;
}

.message-composer textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.message-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.send-btn, .upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.send-btn:hover, .upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.send-btn:active, .upload-btn:active {
    transform: translateY(0);
}

/* File Management */
.wdcp-files {
    max-width: 100%;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.files-header h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.file-upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #dee2e6;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8f9fa;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    transform: scale(1.02);
}

.upload-area p {
    margin: 0;
    font-size: 16px;
    color: #6c757d;
}

.upload-area button {
    background: none;
    border: none;
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.files-list {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    min-height: 200px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.file-item:hover {
    transform: translateX(5px);
}

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

.file-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.file-details h5 {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-weight: 600;
}

.file-meta {
    font-size: 12px;
    color: #6c757d;
}

.file-actions a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #667eea;
    transition: all 0.3s ease;
}

.file-actions a:hover {
    background: #667eea;
    color: white;
}

/* Calendar Styles */
.wdcp-calendar {
    max-width: 100%;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.calendar-header h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.calendar-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.calendar-nav {
    background: #667eea;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.calendar-nav:hover {
    background: #5a67d8;
    transform: scale(1.1);
}

#current-month-year {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    min-width: 180px;
    text-align: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #dee2e6;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
}

.calendar-header-row {
    display: contents;
}

.calendar-day-header {
    background: #2c3e50;
    color: white;
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.calendar-day {
    background: white;
    padding: 12px 8px;
    min-height: 80px;
    position: relative;
    transition: background-color 0.2s ease;
}

.calendar-day:hover {
    background: #f8f9fa;
}

.calendar-day.today {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.calendar-day.empty {
    background: #f8f9fa;
}

.day-number {
    font-weight: 600;
    color: #2c3e50;
}

.day-events {
    margin-top: 5px;
}

.event-dot {
    width: 6px;
    height: 6px;
    background: #667eea;
    border-radius: 50%;
    margin: 2px;
    display: inline-block;
}

.upcoming-events {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.upcoming-events h4 {
    color: #2c3e50;
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
}

.event-item {
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-item:last-child {
    border-bottom: none;
}

.event-title {
    font-weight: 600;
    color: #2c3e50;
}

.event-date {
    font-size: 12px;
    color: #6c757d;
}

/* Invoice Styles */
.wdcp-invoices {
    max-width: 100%;
}

.wdcp-invoices h3 {
    color: #2c3e50;
    margin: 0 0 30px 0;
    font-size: 24px;
    font-weight: 600;
}

.invoices-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.invoices-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.invoices-table td {
    padding: 18px 15px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

.invoices-table tr:last-child td {
    border-bottom: none;
}

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

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-paid {
    background: rgba(40, 167, 69, 0.1);
    color: #155724;
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.status-pending {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.status-overdue {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.view-invoice-btn {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #667eea;
    transition: all 0.3s ease;
    display: inline-block;
}

.view-invoice-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.no-link {
    color: #6c757d;
    font-style: italic;
}

/* Utility Classes */
.no-project-selected {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin: 10px 0;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
    margin: 10px 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .wdcp-overview {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .wdcp-projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .wdcp-portal {
        padding: 0 15px;
    }
    
    .wdcp-header {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .wdcp-header h2 {
        font-size: 24px;
    }
    
    .wdcp-nav {
        justify-content: center;
    }
    
    .wdcp-tab-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .wdcp-tab-content {
        padding: 20px;
    }
    
    .wdcp-projects-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .message-header,
    .files-header,
    .calendar-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .project-selector {
        min-width: auto;
        width: 100%;
    }
    
    .message-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .message-actions input[type="file"] {
        margin-bottom: 10px;
    }
    
    .calendar-controls {
        justify-content: center;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 8px 4px;
    }
    
    .calendar-day-header {
        padding: 10px 5px;
        font-size: 12px;
    }
    
    .invoices-table {
        font-size: 12px;
    }
    
    .invoices-table th,
    .invoices-table td {
        padding: 12px 8px;
    }
    
    /* Stack table on very small screens */
    @media (max-width: 480px) {
        .invoices-table,
        .invoices-table thead,
        .invoices-table tbody,
        .invoices-table th,
        .invoices-table td,
        .invoices-table tr {
            display: block;
        }
        
        .invoices-table thead tr {
            position: absolute;
            top: -9999px;
            left: -9999px;
        }
        
        .invoices-table tr {
            border: 1px solid #ccc;
            border-radius: 8px;
            margin-bottom: 10px;
            padding: 15px;
            background: white;
        }
        
        .invoices-table td {
            border: none;
            padding: 8px 0;
            position: relative;
            padding-left: 35%;
        }
        
        .invoices-table td:before {
            content: attr(data-label) ": ";
            position: absolute;
            left: 0;
            width: 30%;
            font-weight: 600;
            color: #2c3e50;
        }
    }
}

@media (max-width: 480px) {
    .wdcp-header {
        padding: 15px;
    }
    
    .wdcp-tab-content {
        padding: 15px;
    }
    
    .wdcp-project-card {
        padding: 15px;
    }
    
    .project-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
}

/* Print Styles */
@media print {
    .wdcp-header,
    .wdcp-nav,
    .message-composer,
    .file-upload-section,
    .calendar-controls {
        display: none;
    }
    
    .wdcp-tab-content {
        box-shadow: none;
        border: none;
        padding: 0;
    }
    
    .wdcp-portal {
        max-width: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .wdcp-portal {
        color: #e9ecef;
    }
    
    .wdcp-tab-content {
        background: #2c3e50;
        border-color: #495057;
    }
    
    .wdcp-project-card {
        background: linear-gradient(135deg, #3c4858 0%, #495057 100%);
        border-color: #495057;
        color: #e9ecef;
    }
    
    .wdcp-project-card h4 {
        color: #e9ecef;
    }
    
    .message-thread,
    .files-list,
    .upcoming-events,
    .activity-list {
        background: #3c4858;
        border-color: #495057;
    }
    
    .message-item,
    .file-item {
        background: #495057;
        color: #e9ecef;
    }
    
    .calendar-day {
        background: #495057;
        color: #e9ecef;
    }
    
    .calendar-day:hover {
        background: #3c4858;
    }
    
    .invoices-table {
        background: #2c3e50;
    }
    
    .invoices-table td {
        border-color: #495057;
        color: #e9ecef;
    }
    
    .invoices-table tr:hover {
        background: #3c4858;
    }
}

/* Accessibility Improvements */
.wdcp-tab-btn:focus,
.send-btn:focus,
.upload-btn:focus,
.project-selector:focus,
.calendar-nav:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.message-composer textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wdcp-tab-btn.active {
        border: 2px solid #000;
    }
    
    .progress-fill {
        background: #000;
    }
    
    .status-badge {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .progress-fill::after {
        animation: none;
    }
}