/* ======================
   Global Styles & Theme
   ====================== */

:root {
    --primary-color: #9c27b0;
    --primary-hover: #7b1fa2;
    --background-dark: #1a1a1a;
    --background-darker: #121212;
    --surface-color: #2a2a2a;
    --border-color: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --info-color: #2196f3;
    --priority-high: #f44336;
    --priority-medium: #ff9800;
    --priority-low: #2196f3;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ======================
   Login Page Styles
   ====================== */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    width: 120px;
    height: auto;
}

.login-title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    color: var(--primary-color);
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 12px;
    background: var(--background-darker);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

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

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

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

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

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

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

.btn-success:hover {
    background: #43a047;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* ======================
   Dashboard Layout
   ====================== */

.dashboard-header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.header-logo img {
    width: 40px;
    height: auto;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
}

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

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ======================
   Task Filters & Actions
   ====================== */

.dashboard-controls {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.controls-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    width: 100%;
    padding: 10px;
    background: var(--background-darker);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ======================
   Task List
   ====================== */

.task-list {
    display: grid;
    gap: 16px;
}

.task-card {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

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

.task-card.priority-HIGH {
    border-left-color: var(--priority-high);
}

.task-card.priority-MEDIUM {
    border-left-color: var(--priority-medium);
}

.task-card.priority-LOW {
    border-left-color: var(--priority-low);
}

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

.task-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.task-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

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

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

.badge.priority-HIGH {
    background: var(--priority-high);
    color: white;
}

.badge.priority-MEDIUM {
    background: var(--priority-medium);
    color: white;
}

.badge.priority-LOW {
    background: var(--priority-low);
    color: white;
}

.badge.type-feature {
    background: #9c27b0;
    color: white;
}

.badge.type-bug {
    background: #f44336;
    color: white;
}

.badge.type-enhancement {
    background: #2196f3;
    color: white;
}

.badge.type-task {
    background: #ff9800;
    color: white;
}

.task-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-progress {
    margin-top: 16px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.progress-bar {
    height: 6px;
    background: var(--background-darker);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #e91e63);
    border-radius: 3px;
    transition: width 0.3s;
}

/* ======================
   Task Detail Page
   ====================== */

.task-detail-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.task-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.task-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.task-info-card {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 24px;
}

.task-info-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 20px;
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.back-link:hover {
    text-decoration: underline;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.info-item {
    padding: 12px;
    background: var(--background-darker);
    border-radius: 4px;
}

.info-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.workflow-section {
    margin-top: 24px;
}

.workflow-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.workflow-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
}

.workflow-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.workflow-step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

.workflow-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--background-darker);
    border: 2px solid var(--border-color);
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.workflow-step.active .workflow-step-circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.workflow-step.completed .workflow-step-circle {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.workflow-step-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.workflow-step.active .workflow-step-label {
    color: var(--primary-color);
    font-weight: 600;
}

.workflow-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ======================
   Chat Window
   ====================== */

.chat-card {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 20px;
    height: 600px;
    display: flex;
    flex-direction: column;
}

.chat-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    padding: 12px;
    background: var(--background-darker);
    border-radius: 8px;
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.chat-message-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary-color);
}

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

.chat-message-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.chat-input-container {
    display: flex;
    gap: 12px;
}

.chat-input {
    flex: 1;
    padding: 10px;
    background: var(--background-darker);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ======================
   Activity Log
   ====================== */

.activity-card {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 20px;
}

.activity-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    padding: 12px;
    background: var(--background-darker);
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.activity-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.activity-user {
    color: var(--primary-color);
    font-weight: 600;
}

/* ======================
   Modal
   ====================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ======================
   Toast Notifications
   ====================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 16px 20px;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

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

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.info {
    border-left: 4px solid var(--info-color);
}

.toast-message {
    flex: 1;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ======================
   Admin Panel
   ====================== */

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.admin-card {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

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

.admin-title {
    font-size: 20px;
    font-weight: 600;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.users-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table td {
    color: var(--text-primary);
}

.users-table tbody tr:hover {
    background: var(--background-darker);
}

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

/* ======================
   Responsive Design
   ====================== */

@media (max-width: 768px) {
    .dashboard-controls {
        padding: 16px;
    }

    .controls-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .task-detail-grid {
        grid-template-columns: 1fr;
    }

    .task-header {
        flex-direction: column;
        gap: 12px;
    }

    .workflow-steps {
        flex-wrap: wrap;
    }

    .workflow-step {
        flex-basis: 50%;
        margin-bottom: 20px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .toast-container {
        left: 20px;
        right: 20px;
    }

    .toast {
        min-width: auto;
    }
}

/* ======================
   Utility Classes
   ====================== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* ======================
   Status Badges
   ====================== */

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

/* Green for deployed and closed (completed) */
.status-badge.status-deployed,
.status-badge.status-closed {
    background-color: #10b981 !important;
    color: white !important;
}

/* Red for submitted (new/urgent) */
.status-badge.status-submitted {
    background-color: #ef4444 !important;
    color: white !important;
}

/* Yellow/Orange for in progress */
.status-badge.status-in_progress {
    background-color: #f59e0b !important;
    color: white !important;
}

/* Blue for ready for testing */
.status-badge.status-ready_for_testing {
    background-color: #3b82f6 !important;
    color: white !important;
}

/* Purple for testing */
.status-badge.status-testing {
    background-color: #8b5cf6 !important;
    color: white !important;
}

/* Teal for approved */
.status-badge.status-approved {
    background-color: #14b8a6 !important;
    color: white !important;
}

/* Gray for pending (waiting to start) */
.status-badge.status-pending {
    background-color: #6b7280 !important;
    color: white !important;
}

/* Light blue for ready for work (ready to be picked up) */
.status-badge.status-ready_for_work {
    background-color: #06b6d4 !important;
    color: white !important;
}

/* Amber/Gold for code complete (development done) */
.status-badge.status-code_complete {
    background-color: #d97706 !important;
    color: white !important;
}

/* Light green for test passed (QA approved) */
.status-badge.status-test_passed {
    background-color: #22c55e !important;
    color: white !important;
}

/* Dark blue for ready for production (awaiting prod deployment) */
.status-badge.status-ready_for_production {
    background-color: #1e40af !important;
    color: white !important;
}

/* Version Badges */
.version-badges {
    display: flex;
    gap: 12px;
    align-items: center;
}

.version-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    position: relative;
}

.version-badge .env-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.version-badge.test-badge .env-label {
    color: #ffa726; /* Orange for test */
}

.version-badge.production-badge .env-label {
    color: #66bb6a; /* Green for production */
}

.version-badge .version-number {
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Courier New', monospace;
}

/* Custom tooltip */
.version-badge .tooltip {
    visibility: hidden;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: #2a2a2a;
    color: #fff;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.version-badge:hover .tooltip {
    visibility: visible;
}

/* Attachments Display */
.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.attachment-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.attachment-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.attachment-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.attachment-icon {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    margin-bottom: 8px;
}

.attachment-name {
    font-size: 0.875rem;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.attachment-info {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* File Preview Modal */
.file-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.file-preview-modal.show {
    display: flex;
}

.file-preview-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--background-dark);
    border-radius: 12px;
    padding: 20px;
}

.file-preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
}

.file-preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* File Upload Styles */
.file-input {
    display: block;
    width: 100%;
    padding: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

.file-input:focus {
    outline: none;
    border-color: #007bff;
    background: rgba(255, 255, 255, 0.1);
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.file-preview {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.875rem;
    color: #fff;
}

.file-preview-item .file-icon {
    font-size: 1.2rem;
}

.file-preview-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-preview-item .file-size {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}
