/* ==========================================
   TekDek Command Center - Styles
   Modern, clean, professional UI
   ========================================== */

:root {
    --color-primary: #3498db;
    --color-primary-dark: #2980b9;
    --color-secondary: #2c3e50;
    --color-success: #27ae60;
    --color-warning: #f39c12;
    --color-danger: #e74c3c;
    --color-border: #ecf0f1;
    --color-bg-light: #f8f9fa;
    --color-bg: #ffffff;
    --color-text: #2c3e50;
    --color-text-light: #7f8c8d;
    --color-text-lighter: #95a5a6;
    
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    
    --transition: all 0.2s ease;
    
    --sidebar-width: 240px;
    --header-height: 60px;
}

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

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg-light);
}

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

.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-secondary);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    cursor: pointer;
    transition: var(--transition);
}

.logo svg {
    color: var(--color-primary);
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-md) 0;
    overflow-y: auto;
}

.nav-item {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    text-align: left;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background-color: var(--color-primary);
    color: white;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
}

.sidebar-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

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

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

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.view {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-2xl);
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* ==========================================
   Headers and Typography
   ========================================== */

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
    flex-wrap: wrap;
}

.view-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
}

.project-header-info {
    flex: 1;
}

.project-description {
    color: var(--color-text-light);
    margin-top: var(--spacing-sm);
}

.project-header-stats {
    display: flex;
    gap: var(--spacing-lg);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-lighter);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary);
}

/* ==========================================
   Buttons
   ========================================== */

.btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: var(--transition);
    white-space: nowrap;
}

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

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: scale(0.98);
}

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

.btn-secondary:hover {
    background-color: white;
    box-shadow: var(--shadow-md);
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-back {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

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

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text-light);
    cursor: pointer;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* ==========================================
   Filters and Bars
   ========================================== */

.filters-bar,
.task-filters {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
}

.filter-select {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: white;
    color: var(--color-text);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:hover {
    border-color: var(--color-primary);
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

/* ==========================================
   Projects List
   ========================================== */

.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.project-card {
    background-color: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid;
    border-left-color: var(--project-color, var(--color-primary));
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.project-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.project-icon {
    font-size: 28px;
    line-height: 1;
}

.project-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--spacing-xs);
}

.project-card-status {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    background-color: var(--color-bg-light);
    color: var(--color-text-light);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-card-status.active {
    background-color: rgba(39, 174, 96, 0.1);
    color: var(--color-success);
}

.project-card-status.paused {
    background-color: rgba(243, 156, 18, 0.1);
    color: var(--color-warning);
}

.project-card-status.archived {
    background-color: rgba(149, 165, 166, 0.1);
    color: var(--color-text-lighter);
}

.project-card-description {
    color: var(--color-text-light);
    font-size: 13px;
    margin-bottom: var(--spacing-lg);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border);
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--color-text-lighter);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: var(--spacing-xs);
}

.stat-num {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    color: var(--color-text-light);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--spacing-lg);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   Kanban Board
   ========================================== */

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-lg);
    overflow-x: auto;
    padding-bottom: var(--spacing-md);
}

.kanban-column {
    background-color: var(--color-bg-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.kanban-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-border);
}

.kanban-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text);
}

.kanban-count {
    background-color: var(--color-text-lighter);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.kanban-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    min-height: 0;
}

.kanban-list.dragging-over {
    background-color: rgba(52, 152, 219, 0.1);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.task-card {
    background-color: white;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    cursor: grab;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-left: 3px solid var(--task-color, var(--color-primary));
    user-select: none;
}

.task-card:active {
    cursor: grabbing;
    box-shadow: var(--shadow-lg);
    opacity: 0.9;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
}

.task-card.dragging {
    opacity: 0.5;
}

.task-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--spacing-xs);
}

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

.task-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--color-text-lighter);
}

.task-due-date {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.task-due-date.overdue {
    color: var(--color-danger);
    font-weight: 600;
}

.task-due-date.soon {
    color: var(--color-warning);
    font-weight: 600;
}

/* ==========================================
   Forms
   ========================================== */

.form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    padding: var(--spacing-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background-color: white;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

.color-picker {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.color-picker input[type="color"] {
    width: 50px;
    height: 50px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 2px;
}

.color-display {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: inline-block;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.form-actions > div {
    display: flex;
    gap: var(--spacing-md);
}

/* ==========================================
   Modals
   ========================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

.modal-content form {
    padding: var(--spacing-lg);
}

/* ==========================================
   Toasts
   ========================================== */

.toast-container {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.toast {
    background-color: white;
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

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

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

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

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

.toast-message {
    flex: 1;
    color: var(--color-text);
    font-size: 14px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    font-size: 16px;
}

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

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

@media (max-width: 768px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-header {
        padding: var(--spacing-md) var(--spacing-lg);
    }

    .sidebar-nav {
        flex: 1;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 var(--spacing-md);
    }

    .nav-item {
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: 12px;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        height: auto;
        flex: 1;
    }

    .view {
        padding: var(--spacing-lg);
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .view-header h1 {
        font-size: 24px;
    }

    .project-header-stats {
        width: 100%;
        justify-content: space-around;
    }

    .projects-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .toast-container {
        left: var(--spacing-lg);
        right: var(--spacing-lg);
    }

    .toast {
        min-width: unset;
    }
}

@media (max-width: 480px) {
    :root {
        --spacing-xl: 1.5rem;
        --spacing-2xl: 2rem;
        font-size: 13px;
    }

    .view {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .view-header h1 {
        font-size: 20px;
    }

    .projects-list {
        grid-template-columns: 1fr;
    }

    .project-card-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .stat-num {
        font-size: 16px;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .kanban-column {
        min-height: 300px;
    }

    .modal-content {
        width: 98%;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions > div {
        width: 100%;
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }

    .btn-danger {
        width: 100%;
    }
}
