:root {
    --primary-color: #4f46e5; /* Indigo */
    --primary-hover: #4338ca;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    /* Priority Colors */
    --priority-high: #ef4444;
    --priority-high-bg: #fee2e2;
    --priority-medium: #f59e0b;
    --priority-medium-bg: #fef3c7;
    --priority-low: #10b981;
    --priority-low-bg: #d1fae5;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.logo-container img {
    height: 32px;
    width: 32px;
    border-radius: 6px;
    object-fit: cover;
}

.user-greeting {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: white;
    border-color: var(--border-color);
    color: var(--text-main);
}

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

.btn-success {
    background-color: var(--priority-low);
    color: white;
}
.btn-success:hover {
    background-color: #059669;
}

.container {
    max-width: 100%;
    margin: 2rem auto;
    padding: 0 2rem;
}

.dashboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.tabs {
    display: flex;
    gap: 1rem;
}

.tab {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    color: var(--text-muted);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Groups and Subgroups */
.group-section {
    margin-bottom: 3rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.group-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-main);
}

#issuesContainer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    align-items: start;
}

@media (max-width: 768px) {
    #issuesContainer {
        grid-template-columns: 1fr;
    }
}

.subgroup-section {
    margin-bottom: 2rem;
    padding-left: 1rem;
    border-left: 3px solid var(--border-color);
}

.subgroup-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Issue Cards */
.issue-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.issue-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.issue-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.issue-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.issue-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

.issue-desc-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.priority-badge {
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}
.priority-High { background: var(--priority-high-bg); color: var(--priority-high); }
.priority-Medium { background: var(--priority-medium-bg); color: var(--priority-medium); }
.priority-Low { background: var(--priority-low-bg); color: var(--priority-low); }

.issue-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 0.5rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#editIssueModal {
    z-index: 60; /* Ensure edit modal is always on top */
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    transform: scale(0.95);
    transition: transform 0.2s;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

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

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.datalist-input {
    position: relative;
}

/* Notes Section in Detail Modal */
.notes-section {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.note-card {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.note-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.note-text {
    font-size: 0.9rem;
}

.add-note-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.add-note-form input {
    flex: 1;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.loader {
    display: none;
    text-align: center;
    padding: 2rem;
}
.loader.active {
    display: block;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    header {
        flex-direction: column !important;
        gap: 1rem;
        padding: 1rem;
    }
    
    header > div {
        text-align: center !important;
        justify-content: center !important;
        padding: 0 !important;
        flex: none !important;
        width: 100%;
    }
    
    .container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    #issuesContainer {
        grid-template-columns: 1fr;
    }
    
    .dashboard-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .tabs {
        justify-content: center;
        width: 100%;
    }

    .dashboard-controls .btn {
        width: 100%;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
        width: auto;
    }
}
