/* --- Apple UI Inspired Design with Yellow Theme --- */

/* 1. CSS Variables for Theming */
:root {
    /* New Color Palette */
    --color-primary-blue: #3275fb;
    --color-secondary-blue: #4077bd;
    --color-light-blue: #9bbccf;
    --color-dark-gray: #242c36;
    --color-medium-gray: #888c91;

    /* Mapped Theme Variables */
    
    --accent-color: var(--color-light-blue); 
    --bg-color: #f9f9f9; /* Light background */
    --quadrant-bg-color: #ffffff; /* White cards/boxes */
    --text-color: #1d1d1f; /* Near-black text */
    --secondary-text-color: #6e6e73;
    --border-color: #d2d2d7;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --shadow-color-hover: rgba(0, 0, 0, 0.1);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";

    /* light and dark mode for ticket statuses */
    --status-open-bg: var(--border-color);
    --status-open-text: var(--secondary-text-color);
    --status-pending-bg: var(--color-amber);
    --status-pending-text: #000000;
    --status-in-progress-bg: var(--color-blue);
    --status-in-progress-text: #ffffff;
}

body.dark-mode {
    --accent-color: var(--color-light-blue);
    --bg-color: #121212; /* Very dark background */
    --quadrant-bg-color: var(--color-dark-gray); /* Dark gray boxes */
    --text-color: #e1e1e1; /* Off-white text */
    --secondary-text-color: #a1a1a6;
    --border-color: #3a3a3c;
    --shadow-color: rgba(255, 255, 255, 0.05);
    --shadow-color-hover: rgba(255, 255, 255, 0.1);
    
    --status-open-bg: #3a3a3c;
    --status-open-text: #a1a1a6;
    --status-pending-bg: var(--color-amber);
    --status-pending-text: var(--text-color); /* Use the main dark mode text color */
    --status-in-progress-bg: var(--color-blue);
    --status-in-progress-text: #ffffff;
}

/* --- Logo Styles --- */
.logo {
    display: block;
    width: 150px;
    height: auto;
    margin: 0 auto 1.5rem;
    fill: currentColor; /* This makes the SVG take on the text color of its parent */
}

/* Hide the dark logo by default */
.logo-dark {
    display: none;
}

/* In dark mode, hide the light logo and show the dark one */
.dark-mode .logo-light {
    display: none;
}
.dark-mode .logo-dark {
    display: block;
}


/* 2. General Body and Layout Styles */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    transition: background-color 0.3s, color 0.3s;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 3. Header and Dark Mode Toggle */

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

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

#theme-toggle {
    position: fixed; /* Keeps the button in a fixed spot on the screen */
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000; /* Ensures it stays on top of other content */

    background: var(--quadrant-bg-color);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, border-color 0.3s;
}
#theme-toggle:hover {
    background-color: var(--bg-color);
}
#theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color);
}
.icon-sun, .icon-moon { transition: transform 0.3s ease; }
.dark-mode .icon-sun { transform: scale(0); }
.dark-mode .icon-moon { transform: scale(1); }
.icon-moon { position: absolute; transform: scale(0); }

/* 4. Matrix Grid */
.matrix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* 5. Quadrant Styles */
.quadrant {
    background-color: var(--quadrant-bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s, border-color 0.3s;
}

.quadrant-header {
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.quadrant-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.quadrant-subtitle {
    font-size: 1rem;
    font-weight: 500;
    margin: 0.25rem 0 0;
}

/* Color accents for subtitles */
.quadrant.do-first .quadrant-subtitle { color: var(--color-red); }
.quadrant.schedule .quadrant-subtitle { color: var(--color-blue); }
.quadrant.delegate .quadrant-subtitle { color: var(--color-amber); }
.quadrant.delete .quadrant-subtitle { color: var(--color-green); }

/* 6. Task Card Styles */
.task-card {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color-hover);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.task-title {
    font-weight: 600;
    margin: 0;
    flex-grow: 1;
    padding-right: 1rem;
}

.task-meta {
    font-size: 0.875rem;
    color: var(--secondary-text-color);
    margin: 0;
}

.task-list-empty {
    color: var(--secondary-text-color);
    font-style: italic;
}

/* 7. Task List Scrolling Container */
.task-list-container {
    max-height: 255px;
    overflow-y: auto;
    padding-right: 8px;
    margin-right: -8px;
}
.task-list-container::-webkit-scrollbar { width: 6px; }
.task-list-container::-webkit-scrollbar-track { background: transparent; }
.task-list-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 20px;
}

/* 8. Unified Button Styles */
.button-primary {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    color: #000000; /* Black text for best contrast on yellow */
    background-color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s ease;
    font-size: 1rem;
}

.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    filter: brightness(0.95); /* Slightly darken on hover */
}

/* Sizing for "New Task" button */
.header-controls .button-primary {
    width: auto;
    padding: 0.6rem 1.2rem;
}

/* Sizing for full-width buttons in forms */
.task-form .button-primary,
.login-box .button-primary {
    width: 100%;
    padding: 0.85rem;
}

/* Secondary "ghost" style for Edit buttons */
.task-edit-button {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    transition: all 0.2s ease;
}

.task-edit-button:hover {
    background-color: var(--accent-color);
    color: #000000; /* Black text on hover */
}

/* 9. Form and Login Styles */
.task-form,
.login-box {
    background-color: var(--quadrant-bg-color);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.form-group, .task-form p {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label, .task-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--secondary-text-color);
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3); /* Yellow focus glow */
}

body.dark-mode input:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus {
    box-shadow: 0 0 0 3px rgba(246, 173, 66, 0.3); /* Brighter yellow glow for dark mode */
}

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.login-header {
    margin-bottom: 2.5rem; /* Adjust this value to get the space you want */
}

.login-container { width: 100%; max-width: 400px; padding: 2rem; }
.login-box h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.login-box p { color: var(--secondary-text-color); margin-bottom: 2rem; }
.login-page #theme-toggle { display: none; }
.color-bar {
    height: 4px;
    width: 50px;
    margin: 1rem auto;
    border-radius: 2px;
    /* New gradient using your brand's blue palette */
    background: linear-gradient(90deg, var(--color-light-blue), var(--color-primary-blue), var(--color-secondary-blue));
}
.error-message {
    background-color: rgba(229, 62, 62, 0.1);
    color: var(--color-red);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.c-red { color: var(--color-secondary-blue); } /* Was red, now a darker blue */
.c-blue { color: var(--color-primary-blue); } /* Stays the primary blue */
.c-amber { color: var(--color-light-blue); }   /* Was amber, now a light blue */
.c-green { color: var(--color-medium-gray); }  /* Was green, now a neutral gray */

/* Utility class to hide elements for JavaScript interaction */
.hidden {
    display: none;
}

/* --- New styles for Delete functionality --- */

/* Styles for the "Yes, Delete" button */
.button-danger {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    background-color: var(--color-red);
    color: #ffffff;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.button-danger:hover {
    filter: brightness(0.9);
}

/* Styles for the "Cancel" button */
.button-secondary {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    border: none; /* Removed border for a solid look */
    background-color: var(--color-amber); /* Changed to amber */
    color: #000000; /* Black text for best contrast */
    cursor: pointer;
    transition: filter 0.2s ease;
}

.button-secondary:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Container for the two buttons on the confirmation page */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end; /* Aligns buttons to the right */
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

/* Styles for the subtle "Delete this task" link on the edit page */
.delete-link-container {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.delete-link {
    color: var(--color-red);
    text-decoration: none;
    font-weight: 500;
}

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

/* displays status on task card */

.status-open {
    background-color: var(--status-open-bg);
    color: var(--status-open-text);
}
.status-pending {
    background-color: var(--status-pending-bg);
    color: var(--status-pending-text);
}
.status-in_progress {
    background-color: var(--status-in-progress-bg);
    color: var(--status-in-progress-text);
}

/* Style for the linked task title on cards */
.task-title a {
    color: inherit; /* Makes the link use the same color as the h3 tag */
    text-decoration: none; /* Removes the underline */
}

.task-title a:hover {
    text-decoration: underline; /* Adds an underline on hover for clear feedback */
}


/* --- Styles for Task Detail Page --- */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.task-details-panel h3,
.task-activity-panel h3 {
    margin-top: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.task-details-panel h4 {
    margin-top: 1.5rem;
    color: var(--secondary-text-color);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.task-details-panel dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem 1rem;
}

.task-details-panel dt {
    font-weight: 600;
    color: var(--secondary-text-color);
}

.attachment-form,
.comment-list {
    margin-top: 1.5rem;
}

.attachment-list {
    list-style: none;
    padding: 0;
}
.attachment-list li {
    margin-bottom: 0.5rem;
}
.attachment-list a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}
.attachment-list a:hover {
    text-decoration: underline;
}
.meta-text {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
}

.comment {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.comment-author {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
}
.comment p:last-child {
    margin: 0;
}

/* --- Styles for the inline status update form --- */

.status-update-form {
    margin: 0;
}
.status-update-form p {
    margin: 0;
}
.form-select-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 6px;
}
.hidden {
    display: none;
}

/* Style for the ticket number on task cards */
.ticket-number {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    letter-spacing: 0.5px;
}

/* --- Styles for SLA Progress Bar --- */
.sla-bar-container {
    background-color: var(--quadrant-bg-color);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}
.sla-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    margin-bottom: 0.75rem;
}
.sla-achieved {
    font-weight: 600;
    color: var(--color-green);
}
.sla-progress-bar {
    width: 100%;
    height: 10px;
    background-color: var(--bg-color);
    border-radius: 5px;
    overflow: hidden;
}
.sla-progress {
    height: 100%;
    width: 0%; /* Default width */
    background-color: var(--color-amber); /* The yellow color you wanted */
    border-radius: 5px;
    transition: width 0.5s ease-out;
}

/* --- Scrollable Activity Feed on Detail Page --- */

.attachment-list,
.comment-list {
    max-height: 300px; /* Sets a fixed max height for the lists */
    overflow-y: auto;  /* Adds a vertical scrollbar ONLY when the content is taller than the max-height */
    padding-right: 10px; /* Adds some space so the content doesn't touch the scrollbar */
}

/* Optional: Style the scrollbar to match your theme */
.attachment-list::-webkit-scrollbar,
.comment-list::-webkit-scrollbar {
    width: 6px;
}

.attachment-list::-webkit-scrollbar-track,
.comment-list::-webkit-scrollbar-track {
    background: transparent;
}

.attachment-list::-webkit-scrollbar-thumb,
.comment-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 20px;
}


/* --- Styles for Ticket List Page --- */

.filter-form {
    display: flex;
    flex-wrap: wrap; /* Allows filters to wrap on smaller screens */
    gap: 1rem;
    align-items: center;
    padding: 1.5rem; /* Increased padding */
    background-color: var(--quadrant-bg-color);
    border-radius: 12px; /* A more modern border-radius */
    margin-bottom: 2rem;
}

.filter-form select {
    min-width: 150px;
}

.filter-form .button-primary,
.filter-form .button-secondary {
    padding: 0.6rem 1.2rem;
    width: auto;
}

.ticket-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem; /* Increased font size for readability */
}

.ticket-table th,
.ticket-table td {
    padding: 1rem 0.75rem; /* Increased vertical padding */
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.ticket-table th {
    font-weight: 600;
    color: var(--secondary-text-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ticket-table tbody tr:hover {
    background-color: var(--bg-color);
}

.ticket-table a {
    color: var(--color-secondary-blue);
    text-decoration: none;
    font-weight: 600;
}
.ticket-table a:hover {
    text-decoration: underline;
}

/* --- NEW: High-contrast link color specifically for dark mode --- */
body.dark-mode .ticket-table a {
    color: #8ab4f8; /* A bright, accessible blue for dark themes */
}

.ticket-table td[colspan] {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-text-color);
}

/* --- Styles for Scrollable Ticket Table --- */

.table-container {
    max-height: 70vh; /* Sets the max height to 70% of the viewport's height */
    overflow-y: auto; /* Adds a vertical scrollbar when needed */
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.ticket-table thead th {
    position: sticky; /* This makes the header row 'stick' */
    top: 0; /* Sticks it to the top of the scrolling container */
    background-color: var(--quadrant-bg-color); /* Ensures content scrolls under it */
    box-shadow: 0 2px 2px var(--shadow-color); /* Adds a subtle shadow under the header */
}

/* Remove the bottom border from the main table tag, as the container now has a border */
.ticket-table {
    border-bottom: none;
}

/* --- Main Dashboard Layout --- */
.dashboard-layout {
    display: grid;
    /* Give the left column a fixed width and the matrix the rest of the space */
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    /* 'stretch' is the default, but we'll be explicit to ensure columns match height */
    align-items: stretch;
}

/* --- Triage Queue Specific Styles --- */
.triage-queue .task-list-container {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 32rem;
}

.triage-queue {
    display: flex;
    flex-direction: column;
}

/* Optional: Style the scrollbar for the triage queue */
.triage-queue .task-list-container::-webkit-scrollbar {
    width: 6px;
}
.triage-queue .task-list-container::-webkit-scrollbar-track {
    background: transparent;
}
.triage-queue .task-list-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 20px;
}

@media (max-width: 768px) {
    .dashboard-layout,
    .detail-grid,
    .matrix-grid {
        grid-template-columns: 1fr;
    }
    .header-title {
        font-size: 1.75rem;
    }
} 

/* --- Styles for Social Login Button --- */

.social-login {
    /* This will apply to the container holding the button */
}

.button-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.6rem;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
    background-color: var(--quadrant-bg-color);
    transition: background-color 0.2s ease;
}

.button-google:hover {
    background-color: var(--bg-color);
}

.button-google img {
    width: 20px;
    height: 20px;
}

.divider {
    text-align: center;
    margin: 1.5rem 0;
    color: var(--secondary-text-color);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

/* Style for the Google logo in dark mode */
body.dark-mode .button-google img {
    background-color: #ffffff; /* Add a white background for the circle */
    border-radius: 50%;    /* Make the background circular */
    padding: 2px;          /* Add a little space around the 'G' */
    box-sizing: border-box;
}


/* --- Styles for Login Step 2 --- */

.user-display-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#locked-username {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--secondary-text-color);
}

.step-title {
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
}

#back-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--secondary-text-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#back-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

#back-btn svg {
    width: 20px;
    height: 20px;
}

/* connect google button */


.button-connect-google {
    background-color: #4285F4 !important; /* Google Blue */
    color: white !important;
}

.button-connect-google:hover {
    filter: brightness(0.9);
}

/* --- Header Title Size Adjustment --- */
.header .header-title {
    font-size: 1.75rem; /* Reduced from the default h3 size */
    font-weight: 600;
    margin: 0;
}
