/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #667eea;
    text-align: center;
}

.login-box h2 {
    font-size: 20px;
    margin-bottom: 30px;
    text-align: center;
    color: #555;
}

.error-message {
    background-color: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

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

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

.btn-icon {
    padding: 8px 12px;
    font-size: 18px;
    background: transparent;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: #f8f9fa;
    transform: scale(1.1);
}

.btn-icon .theme-icon {
    display: inline-block;
}

/* Dashboard */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dashboard-header h1 {
    color: #667eea;
    font-size: 28px;
}

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

.user-info {
    color: #666;
    font-size: 14px;
}

/* Filters */
.filters {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filters form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filters label {
    font-weight: 500;
    color: #555;
}

.filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

/* Table */
.bug-reports-table {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

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

thead {
    background-color: #f8f9fa;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e9ecef;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
}

tr:hover {
    background-color: #f8f9fa;
}

td.description {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.actions {
    text-align: right;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-new {
    background-color: #cfe2ff;
    color: #004085;
}

.status-in_progress {
    background-color: #fff3cd;
    color: #856404;
}

.status-resolved {
    background-color: #d1e7dd;
    color: #0f5132;
}

.status-closed {
    background-color: #e2e3e5;
    color: #383d41;
}

.status-wont_fix {
    background-color: #f8d7da;
    color: #721c24;
}

/* Details row */
.details-row td {
    background-color: #f8f9fa;
    padding: 20px;
}

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

.detail-section {
    background: white;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.detail-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #667eea;
}

.detail-section pre {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.detail-section select,
.detail-section textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.detail-section textarea {
    resize: vertical;
    font-family: inherit;
}

/* Comments */
.comments-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.comment {
    background-color: #f8f9fa;
    border-left: 3px solid #667eea;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.comment-header strong {
    color: #667eea;
}

.comment-date {
    color: #888;
    font-size: 12px;
}

.comment-body {
    color: #333;
    line-height: 1.5;
}

.no-comments {
    color: #888;
    font-style: italic;
    padding: 10px 0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 20px;
}

.pagination span {
    color: #666;
}

.page-numbers {
    display: flex;
    align-items: center;
    gap: 5px;
}

.page-number {
    display: inline-block;
    padding: 8px 12px;
    text-decoration: none;
    color: #007bff;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: background-color 0.2s, border-color 0.2s;
    min-width: 40px;
    text-align: center;
}

.page-number:hover {
    background-color: #f0f0f0;
    border-color: #007bff;
}

.page-number.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
    cursor: default;
}

.page-dots {
    padding: 8px 4px;
    color: #666;
}

/* Dark Theme - Auto (system preference) or Manual (.dark-theme class) */
@media (prefers-color-scheme: dark) {
    body:not(.theme-manual) {
        color: #e0e0e0;
        background-color: #1a1a1a;
    }

    body:not(.theme-manual) .login-box {
        background: #2d2d2d;
        box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    }

    body:not(.theme-manual) .login-box h1 {
        color: #8b9cff;
    }

    body:not(.theme-manual) .login-box h2 {
        color: #b0b0b0;
    }

    body:not(.theme-manual) .error-message {
        background-color: #4a2020;
        color: #ff9999;
    }

    body:not(.theme-manual) .form-group label {
        color: #b0b0b0;
    }

    body:not(.theme-manual) .form-group input {
        background-color: #3a3a3a;
        border-color: #4a4a4a;
        color: #e0e0e0;
    }

    body:not(.theme-manual) .form-group input:focus {
        border-color: #8b9cff;
    }

    body:not(.theme-manual) .btn-primary {
        background-color: #7c8dff;
    }

    body:not(.theme-manual) .btn-primary:hover {
        background-color: #8b9cff;
    }

    body:not(.theme-manual) .btn-secondary {
        background-color: #4a4a4a;
    }

    body:not(.theme-manual) .btn-secondary:hover {
        background-color: #5a5a5a;
    }

    body:not(.theme-manual) .btn-danger {
        background-color: #d32f2f;
    }

    body:not(.theme-manual) .btn-danger:hover {
        background-color: #e53935;
    }

    body:not(.theme-manual) .btn-icon {
        border-color: #4a4a4a;
    }

    body:not(.theme-manual) .btn-icon:hover {
        background-color: #3a3a3a;
    }

    body:not(.theme-manual) .page-number {
        color: #8b9cff;
        border-color: #4a4a4a;
        background-color: #2d2d2d;
    }

    body:not(.theme-manual) .page-number:hover {
        background-color: #3a3a3a;
        border-color: #8b9cff;
    }

    body:not(.theme-manual) .page-number.active {
        background-color: #7c8dff;
        color: white;
        border-color: #7c8dff;
    }

    body:not(.theme-manual) .page-dots {
        color: #888;
    }

    body:not(.theme-manual) .pagination span {
        color: #b0b0b0;
    }

    body:not(.theme-manual) .dashboard-header {
        background: #2d2d2d;
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }

    body:not(.theme-manual) .dashboard-header h1 {
        color: #8b9cff;
    }

    body:not(.theme-manual) .user-info {
        color: #b0b0b0;
    }

    body:not(.theme-manual) .filters {
        background: #2d2d2d;
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }

    body:not(.theme-manual) .filters label {
        color: #b0b0b0;
    }

    body:not(.theme-manual) .filters select {
        background-color: #3a3a3a;
        border-color: #4a4a4a;
        color: #e0e0e0;
    }

    body:not(.theme-manual) .bug-reports-table {
        background: #2d2d2d;
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }

    body:not(.theme-manual) thead {
        background-color: #3a3a3a;
    }

    body:not(.theme-manual) th {
        color: #b0b0b0;
        border-bottom-color: #4a4a4a;
    }

    body:not(.theme-manual) td {
        border-bottom-color: #3a3a3a;
    }

    body:not(.theme-manual) tr:hover {
        background-color: #3a3a3a;
    }

    body:not(.theme-manual) .status-new {
        background-color: #1e3a5f;
        color: #7db3ff;
    }

    body:not(.theme-manual) .status-in_progress {
        background-color: #4a3f1e;
        color: #ffd97d;
    }

    body:not(.theme-manual) .status-resolved {
        background-color: #1e4a2f;
        color: #7dff9e;
    }

    body:not(.theme-manual) .status-closed {
        background-color: #3a3a3a;
        color: #b0b0b0;
    }

    body:not(.theme-manual) .status-wont_fix {
        background-color: #4a1e1e;
        color: #ff7d7d;
    }

    body:not(.theme-manual) .details-row td {
        background-color: #1a1a1a;
    }

    body:not(.theme-manual) .detail-section {
        background: #2d2d2d;
        border-color: #4a4a4a;
    }

    body:not(.theme-manual) .detail-section h3 {
        color: #8b9cff;
    }

    body:not(.theme-manual) .detail-section pre {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    body:not(.theme-manual) .detail-section select,
    body:not(.theme-manual) .detail-section textarea {
        background-color: #3a3a3a;
        border-color: #4a4a4a;
        color: #e0e0e0;
    }

    body:not(.theme-manual) .pagination span {
        color: #b0b0b0;
    }

    body:not(.theme-manual) .comment {
        background-color: #1a1a1a;
        border-left-color: #8b9cff;
    }

    body:not(.theme-manual) .comment-header strong {
        color: #8b9cff;
    }

    body:not(.theme-manual) .comment-date {
        color: #888;
    }

    body:not(.theme-manual) .comment-body {
        color: #e0e0e0;
    }

    body:not(.theme-manual) .no-comments {
        color: #888;
    }
}

/* Dark Theme - Manual toggle */
body.dark-theme {
    color: #e0e0e0;
    background-color: #1a1a1a;
}

body.dark-theme .login-box {
    background: #2d2d2d;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

body.dark-theme .login-box h1 {
    color: #8b9cff;
}

body.dark-theme .login-box h2 {
    color: #b0b0b0;
}

body.dark-theme .error-message {
    background-color: #4a2020;
    color: #ff9999;
}

body.dark-theme .form-group label {
    color: #b0b0b0;
}

body.dark-theme .form-group input {
    background-color: #3a3a3a;
    border-color: #4a4a4a;
    color: #e0e0e0;
}

body.dark-theme .form-group input:focus {
    border-color: #8b9cff;
}

body.dark-theme .btn-primary {
    background-color: #7c8dff;
}

body.dark-theme .btn-primary:hover {
    background-color: #8b9cff;
}

body.dark-theme .btn-secondary {
    background-color: #4a4a4a;
}

body.dark-theme .btn-secondary:hover {
    background-color: #5a5a5a;
}

body.dark-theme .btn-danger {
    background-color: #d32f2f;
}

body.dark-theme .btn-danger:hover {
    background-color: #e53935;
}

body.dark-theme .btn-icon {
    border-color: #4a4a4a;
}

body.dark-theme .btn-icon:hover {
    background-color: #3a3a3a;
}

body.dark-theme .page-number {
    color: #8b9cff;
    border-color: #4a4a4a;
    background-color: #2d2d2d;
}

body.dark-theme .page-number:hover {
    background-color: #3a3a3a;
    border-color: #8b9cff;
}

body.dark-theme .page-number.active {
    background-color: #7c8dff;
    color: white;
    border-color: #7c8dff;
}

body.dark-theme .page-dots {
    color: #888;
}

body.dark-theme .pagination span {
    color: #b0b0b0;
}

body.dark-theme .dashboard-header {
    background: #2d2d2d;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.dark-theme .dashboard-header h1 {
    color: #8b9cff;
}

body.dark-theme .user-info {
    color: #b0b0b0;
}

body.dark-theme .filters {
    background: #2d2d2d;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.dark-theme .filters label {
    color: #b0b0b0;
}

body.dark-theme .filters select {
    background-color: #3a3a3a;
    border-color: #4a4a4a;
    color: #e0e0e0;
}

body.dark-theme .bug-reports-table {
    background: #2d2d2d;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.dark-theme thead {
    background-color: #3a3a3a;
}

body.dark-theme th {
    color: #b0b0b0;
    border-bottom-color: #4a4a4a;
}

body.dark-theme td {
    border-bottom-color: #3a3a3a;
}

body.dark-theme tr:hover {
    background-color: #3a3a3a;
}

body.dark-theme .status-new {
    background-color: #1e3a5f;
    color: #7db3ff;
}

body.dark-theme .status-in_progress {
    background-color: #4a3f1e;
    color: #ffd97d;
}

body.dark-theme .status-resolved {
    background-color: #1e4a2f;
    color: #7dff9e;
}

body.dark-theme .status-closed {
    background-color: #3a3a3a;
    color: #b0b0b0;
}

body.dark-theme .status-wont_fix {
    background-color: #4a1e1e;
    color: #ff7d7d;
}

body.dark-theme .details-row td {
    background-color: #1a1a1a;
}

body.dark-theme .detail-section {
    background: #2d2d2d;
    border-color: #4a4a4a;
}

body.dark-theme .detail-section h3 {
    color: #8b9cff;
}

body.dark-theme .detail-section pre {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-theme .detail-section select,
body.dark-theme .detail-section textarea {
    background-color: #3a3a3a;
    border-color: #4a4a4a;
    color: #e0e0e0;
}

body.dark-theme .pagination span {
    color: #b0b0b0;
}

body.dark-theme .comment {
    background-color: #1a1a1a;
    border-left-color: #8b9cff;
}

body.dark-theme .comment-header strong {
    color: #8b9cff;
}

body.dark-theme .comment-date {
    color: #888;
}

body.dark-theme .comment-body {
    color: #e0e0e0;
}

body.dark-theme .no-comments {
    color: #888;
}

/* Light Theme - Manual override (force light theme even if system is dark) */
body.light-theme {
    color: #333 !important;
    background-color: #f5f5f5 !important;
}

body.light-theme .login-box {
    background: white !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
}

body.light-theme .dashboard-header {
    background: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

body.light-theme .dashboard-header h1 {
    color: #667eea !important;
}

body.light-theme .filters {
    background: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

body.light-theme .filters select {
    background-color: white !important;
    border-color: #ddd !important;
    color: #333 !important;
}

body.light-theme .bug-reports-table {
    background: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

body.light-theme thead {
    background-color: #f8f9fa !important;
}

body.light-theme th {
    color: #555 !important;
    border-bottom-color: #e9ecef !important;
}

body.light-theme td {
    border-bottom-color: #e9ecef !important;
}

body.light-theme tr:hover {
    background-color: #f8f9fa !important;
}

body.light-theme .detail-section {
    background: white !important;
    border-color: #dee2e6 !important;
}

body.light-theme .detail-section h3 {
    color: #667eea !important;
}

body.light-theme .detail-section pre {
    background-color: #f8f9fa !important;
    color: #333 !important;
}

body.light-theme .detail-section select,
body.light-theme .detail-section textarea {
    background-color: white !important;
    border-color: #ddd !important;
    color: #333 !important;
}

body.light-theme .comment {
    background-color: #f8f9fa !important;
    border-left-color: #667eea !important;
}

body.light-theme .comment-header strong {
    color: #667eea !important;
}

body.light-theme .comment-body {
    color: #333 !important;
}

body.light-theme .btn-icon {
    border-color: #ddd !important;
}

body.light-theme .btn-icon:hover {
    background-color: #f8f9fa !important;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .bug-details {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 14px;
    }

    td.description {
        max-width: 150px;
    }
}
