/* ========================================
   RD & Associates - Client Portal Styles
   ======================================== */

:root {
    /* Colors - Black & Gold Theme */
    --primary-dark: #0A0A0A;
    --primary-navy: #0E0E0E;
    --accent-gold: #C9A962;
    --accent-gold-light: #DFC68A;
    --accent-gold-dark: #A68B4A;
    --text-light: #F8F6F1;
    --text-muted: #CFC7B5;
    --text-dark: #0A0A0A;
    --bg-cream: #F8F6F1;
    --bg-light: #EFE9D8;
    --border-light: rgba(201, 169, 98, 0.2);
}

.client-page {
    background: var(--bg-cream);
    min-height: 100vh;
}

.client-main {
    padding-top: 120px;
    padding-bottom: 80px;
    min-height: calc(100vh - 200px);
}

.client-header {
    text-align: center;
    margin-bottom: 50px;
}

.client-header h1 {
    font-size: 2.5rem;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.client-header p {
    color: #666;
    font-size: 1.1rem;
}

/* ========================================
   Login Section
   ======================================== */
.client-login {
    display: flex;
    justify-content: center;
}

.login-card {
    background: var(--bg-light);
    padding: 60px;
    border: 1px solid var(--border-light);
    max-width: 450px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

.login-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    background: var(--bg-cream);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-icon svg {
    width: 40px;
    height: 40px;
    stroke: var(--accent-gold);
}

.login-card h2 {
    font-size: 1.75rem;
    color: var(--text-dark);
    margin-bottom: 30px;
}

.login-card .form-group label {
    color: var(--text-dark);
}

.login-card form {
    text-align: left;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .btn {
    margin-top: 10px;
}

.login-help {
    margin-top: 30px;
    font-size: 0.9rem;
    color: var(--text-dark);
    line-height: 1.6;
}

.login-help strong {
    color: var(--accent-gold-dark);
}

/* ========================================
   Dashboard
   ======================================== */
.client-dashboard {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dashboard-welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.dashboard-welcome h2 {
    font-size: 1.75rem;
    color: var(--text-dark);
}

.dashboard-welcome span {
    color: var(--accent-gold-dark);
}

.btn-logout {
    padding: 10px 25px;
    background: transparent;
    border: 1px solid #dc3545;
    color: #dc3545;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-logout:hover {
    background: #dc3545;
    color: white;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.dashboard-card {
    background: var(--bg-light);
    padding: 30px;
    border: 1px solid var(--border-light);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.dashboard-card.full-width {
    grid-column: span 2;
}

.dashboard-card h3 {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

/* Case Info */
.case-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    color: #888;
    font-size: 0.9rem;
}

.detail-row .value {
    font-weight: 600;
    color: var(--text-dark);
}

/* Case Status */
.status-indicator {
    margin-bottom: 25px;
}

.status-badge {
    display: inline-block;
    padding: 8px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 3px;
}

.status-badge.status-active,
.status-badge.status-actif {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge.status-pending,
.status-badge.status-en_attente {
    background: #fff3e0;
    color: #ef6c00;
}

.status-badge.status-closed,
.status-badge.status-cloture {
    background: #e3f2fd;
    color: #1565c0;
}

.status-badge.status-audience {
    background: #fce4ec;
    color: #c2185b;
}

.status-badge.status-gagne {
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 700;
}

.status-badge.status-perdu {
    background: #ffebee;
    color: #c62828;
}

/* Timeline */
.status-timeline {
    position: relative;
    padding-left: 25px;
}

.status-timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ddd;
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -25px;
    top: 0;
    width: 12px;
    height: 12px;
    background: #ddd;
    border-radius: 50%;
    border: 2px solid var(--bg-light);
}

.timeline-item.completed .timeline-dot {
    background: var(--accent-gold);
}

.timeline-item.active .timeline-dot {
    background: #2e7d32;
    box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.2);
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.timeline-date {
    font-size: 0.75rem;
    color: #999;
}

.timeline-text {
    font-size: 0.9rem;
    color: var(--text-dark);
}

.timeline-item.active .timeline-text {
    font-weight: 600;
    color: #2e7d32;
}

/* Documents */
.documents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--bg-cream);
    border: 1px solid #eee;
}

.doc-icon {
    font-size: 1.25rem;
}

.doc-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.doc-status {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 3px;
}

.doc-status.signed {
    background: #e8f5e9;
    color: #2e7d32;
}

.doc-status.received {
    background: #e3f2fd;
    color: #1565c0;
}

.doc-status.pending {
    background: #fff3e0;
    color: #ef6c00;
}

/* Document with file */
.document-item.has-file {
    border-color: var(--accent-gold);
    background: rgba(201, 169, 98, 0.05);
}

.doc-view-btn {
    padding: 4px 12px;
    background: var(--accent-gold);
    color: var(--primary-dark);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 3px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.doc-view-btn:hover {
    background: var(--accent-gold-light);
}

/* Next Steps */
.steps-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.step-item {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.step-date {
    width: 60px;
    height: 60px;
    background: var(--primary-navy);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-date .day {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.step-date .month {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.step-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 5px;
}

.step-title {
    font-weight: 600;
    color: var(--text-dark);
}

.step-time {
    font-size: 0.85rem;
    color: #666;
}

/* Messages */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message-item {
    display: flex;
    gap: 20px;
}

.message-avatar {
    width: 50px;
    height: 50px;
    background: var(--accent-gold);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    background: var(--bg-cream);
    padding: 20px;
    border: 1px solid #eee;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.message-author {
    font-weight: 600;
    color: var(--text-dark);
}

.message-date {
    font-size: 0.8rem;
    color: #999;
}

.message-content p {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.7;
    margin: 0;
}

/* Dashboard Footer */
.dashboard-footer {
    margin-top: 50px;
    text-align: center;
    padding: 30px;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
}

.dashboard-footer p {
    color: #666;
    font-size: 0.9rem;
    margin: 5px 0;
}

.dashboard-footer strong {
    color: var(--accent-gold-dark);
}

/* Client Footer */
.client-footer {
    padding: 30px 0;
}

/* ========================================
   Chat Section
   ======================================== */
.chat-section {
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

.chat-header h3 {
    margin: 0;
    padding: 0;
    border: none;
}

.chat-status {
    font-size: 0.8rem;
    color: #27ae60;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 400px;
    background: var(--bg-cream);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.chat-empty p {
    margin: 5px 0;
}

.chat-message {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 12px;
    animation: chatFadeIn 0.3s ease;
}

@keyframes chatFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.sent {
    align-self: flex-end;
    background: var(--primary-navy);
    color: var(--text-light);
    border-bottom-right-radius: 4px;
}

.chat-message.received {
    align-self: flex-start;
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
}

.chat-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 15px;
}

.chat-msg-sender {
    font-weight: 600;
    font-size: 0.8rem;
}

.chat-message.sent .chat-msg-sender {
    color: var(--accent-gold);
}

.chat-msg-time {
    font-size: 0.7rem;
    opacity: 0.7;
}

.chat-msg-text {
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-msg-attachments {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chat-attachment {
    display: inline-block;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.chat-message.sent .chat-attachment {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-light);
}

.chat-message.received .chat-attachment {
    background: var(--bg-cream);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
}

.chat-attachment:hover {
    background: rgba(201, 169, 98, 0.3);
}

.chat-attachment.image {
    position: relative;
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
}

.chat-attachment.image img {
    width: 150px;
    height: 100px;
    object-fit: cover;
    display: block;
}

.chat-attachment.image .download-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    background: var(--accent-gold);
    color: var(--primary-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-attachment.image:hover .download-btn {
    opacity: 1;
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px;
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
}

.chat-attachments {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.chat-file-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-cream);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.8rem;
}

.chat-file-preview img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.chat-file-preview .file-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-file-preview .remove-file {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 5px;
}

.chat-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-attach-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-cream);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.chat-attach-btn:hover {
    border-color: var(--accent-gold);
    background: rgba(201, 169, 98, 0.1);
}

.chat-form input[type="text"] {
    flex: 1;
    padding: 12px 18px;
    background: var(--bg-cream);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.chat-form input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.chat-send-btn {
    padding: 12px 25px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-gold-dark));
    border: none;
    border-radius: 8px;
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(201, 169, 98, 0.3);
}

.chat-hint {
    margin-top: 8px;
    font-size: 0.75rem;
    color: #999;
    text-align: center;
}

/* Welcome area improvements */
.welcome-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.welcome-dossier {
    font-size: 0.9rem;
    color: #888;
}

.welcome-right {
    display: flex;
    gap: 10px;
}

.btn-refresh {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-light);
    color: #666;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-refresh:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold-dark);
}

/* Case notes */
.case-notes {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.case-notes h4 {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: #888;
    margin-bottom: 10px;
}

.case-notes p {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

/* Empty list */
.empty-list {
    text-align: center;
    color: #999;
    font-size: 0.9rem;
    padding: 30px 15px;
}

/* Timeline dot improvements */
.timeline-dot.completed {
    background: var(--accent-gold);
}

.timeline-dot.pending {
    background: #ddd;
}

.timeline-desc {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin: 0;
}

/* RDV items */
.rdv-item {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: var(--bg-cream);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 10px;
}

.rdv-item.past {
    opacity: 0.6;
}

.rdv-item.upcoming {
    border-left: 3px solid var(--accent-gold);
}

.rdv-date-box {
    width: 50px;
    text-align: center;
}

.rdv-day {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-navy);
    line-height: 1;
}

.rdv-month {
    display: block;
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
}

.rdv-info {
    flex: 1;
}

.rdv-title {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 3px;
}

.rdv-details {
    font-size: 0.85rem;
    color: #666;
}

/* Doc info improvements */
.doc-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.doc-view-link {
    padding: 6px 12px;
    background: var(--accent-gold);
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.doc-view-link:hover {
    background: var(--accent-gold-light);
}

/* Status improvements */
.doc-status.status-pending { background: #fff3e0; color: #ef6c00; }
.doc-status.status-received { background: #e3f2fd; color: #1565c0; }
.doc-status.status-signed { background: #e8f5e9; color: #2e7d32; }
.doc-status.status-sent { background: #f3e5f5; color: #7b1fa2; }
.doc-status.status-validated { background: #e8f5e9; color: #1b5e20; font-weight: 700; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .client-main {
        padding-top: 100px;
    }
    
    .login-card {
        padding: 40px 30px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-card.full-width {
        grid-column: span 1;
    }
    
    .dashboard-welcome {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .message-item {
        flex-direction: column;
    }
    
    .message-avatar {
        width: 40px;
        height: 40px;
    }
}
