
:root {
    --primary-color: #6b4fbb;
    --secondary-color: #2e2e2e;
    --border-color: #e5e5e5;
    --grid-line-color: #f0f0f0;
    --warning-color: #f0ad4e;
    --problem-color: #ffa500;
    --quarter-line-color: #f8f8f8;
    --highlight-color: #8c4bff;
    --drag-highlight: rgba(107, 79, 187, 0.2);
    --drop-target: rgba(140, 75, 255, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--secondary-color);
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
}

#app {
    max-width: 1800px;
    width:98%;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

button {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--highlight-color);
}

#calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.total-hours {
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: normal;
    margin-top: 2px;
}

.weekly-total {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0 10px;
}

#calendar-grid {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    user-select: none;
}

.time-column {

    padding-top: 45px;
    width: 60px;
    border-right: 1px solid var(--border-color);
    background: white;
    z-index: 100;
    position: relative;
}

#days-container {
    display: flex;
    flex-grow: 1;
    position: relative;
}

.day-column {
    flex: 1;
    min-width: 120px;
    border-right: 1px solid var(--border-color);
    position: relative;
    height: calc(24 * 60px ); /* 24 hours * 60px per hour + header height */
}

.day-column:last-child {
    border-right: none;
}

.day-header {
    height: 45px;
    padding: 4px;
    text-align: center;
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.time-slot {
    height: 60px;
    border-bottom: 1px solid var(--grid-line-color);
    position: relative;
}

.quarter-hour {
    height: 15px;
    border-bottom: 1px dashed var(--quarter-line-color);
    transition: background-color 0.2s, cursor 0.2s;
    cursor: default;
}

.quarter-hour:last-child {
    border-bottom: none;
}

.quarter-hour.drop-target {
    background-color: var(--drop-target);
}

.timelog-entry {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    will-change: transform;
    position: absolute;
    border-radius: 3px;
    color: white;
    background-color: var(--primary-color);
    font-size: 0.8rem;
    padding: 2px 4px;
    transition: all 0.2s ease;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.timelog-entry:active {
    cursor: grabbing;
}

.drag-ghost {
    opacity: 0.9;
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    cursor: grabbing;
    z-index: 1000;
    position: fixed;
    background-color: var(--primary-color);
    border-radius: 3px;
    color: white;
    transition: none;
}

.timelog-entry.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.day-column.drag-over {
    background-color: var(--drag-highlight);
}

.day-column.drag-over .quarter-hour {
    background-color: var(--drag-highlight);
    cursor: grabbing;
}

.day-column.drag-over .quarter-hour.drop-target {
    background-color: var(--drop-target);
    cursor: grabbing;
    transition: background-color 0.15s ease-in-out;
}

.time-label {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--secondary-color);
    border-bottom: 1px solid var(--grid-line-color);
    background: white;
}

.timelog-content {
    height: 100%;
    padding: 2px 4px;
    pointer-events: none;
}

.timelog-title {
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.timelog-note-container {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    position: relative;
    min-height: 120px;
}

.timelog-note-input {
    width: 100%;
    margin: 8px 0;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
}

.timelog-note-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(107, 79, 187, 0.25);
}

.timelog-time-input,
.timelog-datetime-input {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    position: relative;
    min-height: 85px;
}

.datetime-inputs {
    display: flex;
    gap: 10px;
    margin: 8px 0;
}

.date-input,
.time-input {
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

.date-input:focus,
.time-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(107, 79, 187, 0.25);
}

.time-spent-input {
    width: 100px;
    margin: 8px 0;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

.time-spent-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(107, 79, 187, 0.25);
}

.timelog-time-input label,
.timelog-note-container label,
.timelog-datetime-input label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.time-validation-feedback,
.note-validation-feedback,
.datetime-validation-feedback {
    font-size: 10px;
    width: 200px;
    text-align: right;
    min-height: 20px;
}

.save-note-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.save-note-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.65;
}

.popup-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
    margin-left: auto;
}

.timelog-summary {
    font-size: 0.75rem;
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
    opacity: 0.9;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 2px;
}

.timelog-duration {
    font-size: 0.75rem;
    opacity: 0.9;
}

.timelog-entry:hover {
    opacity: 1;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timelog-entry.overlapping {
    border-left: 2px solid rgba(255, 255, 255, 0.5);
}

.timelog-entry.overlapping:first-child {
    border-left: none;
}

#user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-name {
    font-weight: bold;
}

.timelog-entry.has-problems {
    background-color: var(--problem-color);
}

.timelog-problems {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.problem-item {
    background-color: var(--warning-color);
    padding: 5px;
    margin: 5px 0;
    border-radius: 3px;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    #app {
        padding: 10px;
    }

    .day-column {
        min-width: 80px;
    }

    .time-column {
        width: 40px;
    }

    .time-label {
        font-size: 0.7rem;
    }

    .timelog-entry {
        font-size: 0.7rem;
    }

    .timelog-duration {
        font-size: 0.65rem;
    }
}

.timelog-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 90%;
}

.popup-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.popup-content-h4 {
    margin-top: 8px;
    margin-bottom: 0;
    text-align: center;
    color: #595151;
}

.popup-content p {
    margin: 8px 0;
}

.close-popup .delete-timelog-button .create-new-button .save-note-button {
    margin-top: 10px;
    padding: 6px 12px;
    display: block;
}

/* Loading Modal Styles */
.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-spinner {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

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

/* Activity Panel Styles */
.main-content {
    display: flex;
    gap: 20px;
}

#calendar-grid {
    flex: 1;
}

.activity-panel {
    width: 300px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 15px;
    line-height: 1.2;
}

.activity-panel h2 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.activity-epic-item {
    margin-bottom: 16px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.activity-epic-header {
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: start;
    border-bottom: 1px solid var(--border-color);
}

.activity-epic-header:hover {
    background: #f0f0f0;
}

.activity-epic-header:hover {
    background: #e9ecef;
}

.activity-issues-list {
    padding-top: 0;
    padding-right: 0;
    padding-left: 16px;
    padding-bottom: 0;
}

.activity-epic-title-wrapper,
.activity-issue-title-wrapper {
    width: 100%;
    margin-top: 4px;
}

.activity-issue-title {
    font-size: 10pt;
    color: var(--secondary-color);
    display: block;
    margin-top: 4px;
}

.activity-epic-title {
    font-size: 10pt;
    color: var(--secondary-color);
    display: block;
}

.activity-epic-info {
    display: flex;
    align-items:start;
    gap: 8px;
}

.activity-epic-ref {
    color: var(--primary-color);
    font-weight: 600;
    font-family: monospace;
}

.activity-epic-group {
    color: #666;
    font-size: 0.9em;
}

.activity-issue-item {
    padding: 8px 12px;
    margin: 4px 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.activity-issue-item:hover {
    background: #f0f0f0;
}

.activity-issue-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.activity-issue-ref {
    color: var(--primary-color);
    font-weight: 600;
    font-family: monospace;
}

.activity-issue-project {
    color: #666;
    font-size: 0.9em;
}

.activity-issue-item:hover {
    background: #f8f9fa;
    border-radius: 4px;
}

.activity-badge {
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 8px;
}

.activity-badge.modified {
    background: #e3f2fd;
    color: #1976d2;
}

.activity-badge.commented {
    background: #f1f8e9;
    color: #689f38;
}

/* Error Modal Styles */
.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.error-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.error-title {
    color: #d93025;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.error-message {
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.error-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.error-button:hover {
    background-color: var(--highlight-color);
}

.gitlab-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: none;
    margin-right: 8px;
}

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

.gitlab-link:hover {
    color: var(--highlight-color);
}

.gitlab-link svg {
    width: 16px;
    height: 16px;
    margin-left: 4px;
}

.email-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.email-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.email-content h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.project-list {
    margin: 15px 0;
}

.project-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

.project-item:last-child {
    border-bottom: none;
}

.project-item label {
    margin-left: 8px;
    flex-grow: 1;
    cursor: pointer;
}

.email-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.email-actions button {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.email-actions button.cancel {
    background-color: #dc3545;
}

.email-actions button.send {
    background-color: var(--primary-color);
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    padding: 20px;
}

.app-content {
    display: none;
}

.app-content.authenticated {
    display: block;
}

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