/* Basic Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #2c3e50; /* Darker header for contrast */
    padding: 1rem 2rem;
    border-bottom: 1px solid #34495e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ecf0f1;
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
    color: #ecf0f1;
}

nav a {
    margin: 0 1rem;
    text-decoration: none;
    color: #bdc3c7; /* Lighter grey for navigation */
    font-weight: 500;
    transition: color 0.3s ease;
}

nav a:hover {
    color: #ecf0f1;
}

#auth-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#auth-status {
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: #7f8c8d;
}

#auth-status.authed {
    background: #2ecc71;
}

#auth-token-input {
    width: 220px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #95a5a6;
    border-radius: 4px;
    background: #ecf0f1;
    color: #2c3e50;
}

main {
    flex-grow: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Reusable Components */
.card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
    animation: card-fade-in 0.5s ease-in-out;
    border: 1px solid #e0e0e0;
}

@keyframes card-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.button {
    background-color: #3498db; /* A vibrant blue */
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.button:hover {
    background-color: #2980b9;
}

.button.danger {
    background-color: #e74c3c;
}

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

.error {
    color: #e74c3c;
    font-weight: bold;
}

/* Grid Layouts */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    grid-gap: 2rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    grid-gap: 2rem;
}

.card.full-width {
    grid-column: 1 / -1;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.role-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.role-table th,
.role-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}

.role-table th {
    background-color: #f2f4f7;
    font-weight: 600;
    color: #2c3e50;
}

.role-table tr:hover td {
    background-color: #f8f9fb;
}

/* Forms */
form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

form input[type="text"] {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Loading Spinner */
#loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

/* Task Display Styles */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-block;
}

.status-open { background-color: #3b82f6; color: white; }
.status-claimed { background-color: #8b5cf6; color: white; }
.status-in_progress { background-color: #f59e0b; color: white; }
.status-completed { background-color: #10b981; color: white; }
.status-closed { background-color: #6b7280; color: white; }
.status-blocked { background-color: #ef4444; color: white; }

.priority-critical { background-color: #dc2626; color: white; }
.priority-high { background-color: #f59e0b; color: white; }
.priority-medium { background-color: #3b82f6; color: white; }
.priority-low { background-color: #6b7280; color: white; }

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    background-color: #e5e7eb;
    border-radius: 12px;
    font-size: 0.875rem;
}

.tag.tech {
    background-color: #dbeafe;
    color: #1e40af;
}

.description {
    white-space: pre-wrap;
    line-height: 1.6;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.timestamps {
    font-size: 0.875rem;
    color: #6b7280;
}

.task-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.task-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 1.25rem;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

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

.task-card h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.task-card h3 a {
    color: #2c3e50;
    text-decoration: none;
}

.task-card h3 a:hover {
    color: #3498db;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.repo-badge {
    padding: 0.25rem 0.5rem;
    background-color: #f3f4f6;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #6b7280;
}

.task-description {
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.5;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        padding: 1rem;
    }

    nav {
        margin-top: 1rem;
    }

    nav a {
        margin: 0 0.5rem;
    }

    main {
        padding: 1rem;
    }

    .dashboard-grid,
    .grid {
        grid-template-columns: 1fr;
        grid-gap: 1rem;
    }

    .card {
        margin-bottom: 1rem;
    }

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