/* Project Chat - User Interface Styles
   Based on: chat-client-with-role-based-tasks.html mockup */

:root {
    /* WhatsApp Color Scheme */
    --primary: #128C7E;
    --primary-dark: #075E54;
    --teal: #25D366;
    --light-bg: #F0F2F5;
    --chat-bg: #E5DDD5;
    --message-out: #D9FDD3;
    --message-in: #FFFFFF;
    --border: #D1D7DB;
    --text: #111B21;
    --text-muted: #667781;
    --hover: #F5F6F6;
    
    /* Status Colors */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.app-container {
    display: flex;
    height: 100vh;
    background: var(--light-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Navigation Sidebar */
.nav-sidebar {
    width: 80px;
    background: var(--primary-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 12px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    z-index: 100;
}

.nav-tab {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.2s;
    position: relative;
}

.nav-tab:hover:not([disabled]) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(2px);
}

.nav-tab.active {
    background: var(--teal);
}

.nav-tab[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-icon {
    font-size: 24px;
}

.nav-label {
    font-size: 9px;
    color: white;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.nav-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

/* Header */
.chat-header {
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    z-index: 50;
}

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

.project-channel-selectors {
    display: flex;
    gap: 10px;
}

.header-select {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-width: 200px;
}

.header-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.header-select option {
    background: var(--primary);
    color: white;
}

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

.role-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

.role-selector label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.role-display {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.25);
}

.role-display.role-designer {
    background: #4338ca;
}

.role-display.role-client {
    background: #dc2626;
}

.role-display.role-contractor {
    background: #16a34a;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

/* Screens */
.project-chat-screen {
    display: none;
    flex: 1;
    overflow: hidden;
}

.project-chat-screen.active {
    display: flex;
    flex-direction: column;
}

/* Chat Screen */
#screen-chat {
    background: var(--chat-bg);
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0l30 30-30 30L0 30z' fill='%23D9DBD5' fill-opacity='0.06'/%3E%3C/svg%3E");
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chat-empty-state,
.tasks-empty-state,
.files-empty-state,
.notifications-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.chat-empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text);
}

.chat-empty-state p {
    font-size: 14px;
}

/* Messages */
.message {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    animation: slideIn 0.2s;
}

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

.message.sent {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--message-in);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.sent .message-bubble {
    background: var(--message-out);
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.message.sent .message-sender {
    display: none;
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

.message-file {
    background: rgba(0,0,0,0.05);
    padding: 10px;
    border-radius: 6px;
    margin-top: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.message-file:hover {
    background: rgba(0,0,0,0.08);
}

/* Chat Input */
.chat-input-container {
    background: var(--light-bg);
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.input-button:hover:not(:disabled) {
    background: var(--hover);
    transform: scale(1.05);
}

.input-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.message-input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 21px;
    border: none;
    background: white;
    font-size: 15px;
    font-family: inherit;
}

.message-input:focus {
    outline: none;
}

.message-input:disabled {
    background: #e9ecef;
    cursor: not-allowed;
}

.send-button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-button:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-icon {
    font-size: 20px;
}

/* Tasks Screen */
#screen-tasks {
    background: var(--light-bg);
    padding: 20px;
}

.no-access-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.no-access-icon {
    font-size: 72px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.no-access-message h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text);
}

.no-access-message p {
    font-size: 16px;
    color: var(--text-muted);
    max-width: 500px;
    margin: 6px 0;
}

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

.tasks-header h2 {
    font-size: 24px;
    color: var(--text);
}

.tasks-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: var(--hover);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tasks-container {
    overflow-y: auto;
}

.task-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.task-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.task-card.status-pending {
    border-left-color: var(--warning);
}

.task-card.status-approved {
    border-left-color: var(--success);
}

.task-card.status-rejected {
    border-left-color: var(--danger);
}

.task-card.status-completed {
    border-left-color: var(--info);
}

.task-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.task-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.task-cost {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.task-description {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.task-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.task-actions {
    display: flex;
    gap: 8px;
}

.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-text {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--hover);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-text {
    background: transparent;
    color: var(--primary);
}

.btn-text:hover {
    background: rgba(18, 140, 126, 0.1);
}

/* Files Screen */
#screen-files {
    background: var(--light-bg);
    padding: 20px;
}

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

.files-header h2 {
    font-size: 24px;
    color: var(--text);
}

.files-filters {
    display: flex;
    gap: 10px;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    width: 250px;
}

.files-container {
    overflow-y: auto;
}

.file-item {
    background: white;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.file-item:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transform: translateX(2px);
}

.file-icon {
    font-size: 32px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.file-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* Notifications Screen */
#screen-notifications {
    background: var(--light-bg);
    padding: 20px;
}

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

.notifications-header h2 {
    font-size: 24px;
    color: var(--text);
}

.notifications-container {
    overflow-y: auto;
}

.notification-item {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 10px;
    border-left: 4px solid var(--info);
    cursor: pointer;
    transition: all 0.2s;
}

.notification-item.unread {
    background: #eff6ff;
}

.notification-item:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.notification-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.notification-message {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.notification-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

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

.modal-header h3 {
    font-size: 20px;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--hover);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--border);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-sidebar {
        width: 60px;
    }
    
    .nav-tab {
        width: 48px;
        height: 48px;
    }
    
    .nav-label {
        display: none;
    }
    
    .header-select {
        min-width: 150px;
        font-size: 13px;
    }
    
    .role-selector {
        padding: 4px 8px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}
