/* --- Global Styles & Variables - Light Theme (Login-inspired Design) --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8ecf3;
    --border-color: #d1d9e6;
    --text-primary: #091c3a;
    --text-secondary: #506279;
    --text-muted: #8896a6;

    /* Accent colors from login */
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-hover: #5a6fd6;

    /* Gradient definitions */
    --gradient-accent: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-header: linear-gradient(135deg, #091c3a 0%, #1a3a5c 100%);
    --gradient-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);

    /* Priority colors */
    --priority-high: #ef4444;
    --priority-medium: #f59e0b;
    --priority-low: #22c55e;

    /* Ticket type colors */
    --type-ticket: #3b82f6;
    --type-approval: #a855f7;
    --type-task: #22c55e;

    /* Enhanced shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-accent: 0 6px 20px rgba(102, 126, 234, 0.35);
}

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

html {
    overflow-x: hidden;
}

body {
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: var(--gradient-bg);
    background-attachment: fixed;
    color: var(--text-primary);
    font-size: 16px;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* --- Custom Scrollbar Styles --- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    border: 2px solid var(--bg-tertiary);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6b4199 100%);
}

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--gradient-header);
    border-bottom: none;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 100;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.app-header h1 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-logo {
    display: inline-block;
    width: 50px;
    height: 50px;
    background-color: #ffffff;
    -webkit-mask-image: url('https://ticketing.coreidon.ai/assets/only_logo.svg');
    mask-image: url('https://ticketing.coreidon.ai/assets/only_logo.svg');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    transition: all 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.05);
}

.app-header h1 .header-title-text {
    display: inline-block;
    transition: all 0.3s ease;
    color: #ffffff;
    font-size: clamp(0.8rem, 0.5rem + 1.2vw, 1.5rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-shrink: 1;
}

#newTicketBtn {
    background: var(--gradient-accent);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

#newTicketBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

#newTicketBtn:active {
    transform: translateY(0);
}

.view-switcher {
    display: flex;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 4px;
    backdrop-filter: blur(10px);
}

.view-switcher button {
    background-color: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-switcher button.active {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.view-switcher button:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

/* --- Theme Switcher --- */
.theme-switcher {
    display: flex;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background: var(--gradient-accent);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* --- Language Switcher --- */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.language-switcher label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 500;
}

.language-switcher select {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.language-switcher select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* --- Hamburger Menu --- */
.hamburger-menu {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    margin-left: 1rem;
    transition: all 0.3s ease;
}

.hamburger-menu:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Mobile Styles --- */
@media (max-width: 768px) {
    .app-header {
        padding: 0.8rem 1rem;
    }

    .header-left {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .app-header h1 {
        font-size: 1.3rem;
        flex-basis: 100%;
        order: -1;
        justify-content: space-between;
    }

    .app-header h1 .header-title-text {
        display: inline-block;
    }

    .header-logo {
        width: 32px;
        height: 32px;
        transition: all 0.3s ease;
    }

    #newTicketBtn {
        padding: 0.6rem 1.1rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .view-switcher {
        padding: 3px;
    }

    .view-switcher button {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .language-switcher label {
        display: none;
    }

    .language-switcher select {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    .switch {
        width: 45px;
        height: 26px;
    }

    .slider:before {
        height: 18px;
        width: 18px;
    }

    input:checked + .slider:before {
        transform: translateX(19px);
    }

    .hamburger-menu {
        display: block;
        font-size: 1.25rem;
        padding: 0.4rem 0.6rem;
        margin-left: 0;
    }

    #newTicketBtn {
        flex-shrink: 0;
        padding: 0.5rem 0.9rem;
        font-size: 0.75rem;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        box-shadow: var(--shadow-lg);
        flex-grow: 0;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .app-container {
        overflow-x: hidden;
    }

    body.sidebar-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(9, 28, 58, 0.6);
        z-index: 998;
        backdrop-filter: blur(4px);
    }

    .filter-container {
        display: none !important;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.75rem;
    }

    .filter-container.open {
        display: flex !important;
    }

    .filter-container > *,
    .filter-container .autocomplete-container {
        flex-grow: 1;
        flex-basis: calc(50% - 0.5rem);
    }

    .tags-filter-container {
        flex: 0 0 100%;
        width: 100%;
        order: 5;
    }

    #tagsFilterToggle {
        max-width: 100%;
    }

    .tags-filter-dropdown {
        width: 100%;
    }

    .filter-actions {
        order: 10;
    }

    #toggleFiltersBtn {
        display: block !important;
        width: 100%;
        margin-bottom: 1rem;
    }
}

#toggleFiltersBtn {
    display: none;
}

/* --- Main Layout --- */
.app-container {
    display: flex;
    height: calc(100vh - 73px);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* --- Sidebar --- */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-left: none;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.sidebar h3 {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 1.5rem 0 0.75rem 0;
    font-weight: 600;
    position: relative;
    padding-bottom: 0.5rem;
}

.sidebar h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--gradient-accent);
    border-radius: 2px;
}

.sidebar h3:first-child {
    margin-top: 0;
}

#settingsContainer {
    margin-top: 2.5rem;
}

.nav-list, .team-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-list li, .team-list li {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.team-list li {
    overflow: visible;
}

.nav-list li::before, .team-list li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.nav-list li:hover, .team-list li:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-list li.active, .team-list li.active {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-accent);
}

.nav-list li.active::before, .team-list li.active::before {
    opacity: 1;
}

/* Settings nav items behave like buttons, not filters */
#settingsContainer .nav-list li {
    cursor: pointer;
}

#settingsContainer .nav-list li:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateX(0);
}

#settingsContainer .nav-list li.active {
    background: transparent;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    box-shadow: none;
}

#settingsContainer .nav-list li.active::before {
    opacity: 0;
}

.team-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.team-actions {
    display: flex;
    gap: 0.25rem;
}

.global-team-indicator {
    margin-left: 0.5rem;
    font-size: 0.8rem;
}

/* --- Manager Info Tooltip --- */
.manager-info {
    display: inline-block;
    position: relative;
    margin-left: 0.5rem;
    color: var(--text-muted);
    cursor: help;
    font-weight: bold;
    border: 1px solid var(--text-muted);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
    font-size: 12px;
}

.team-list li.active .manager-info {
    color: white;
    border-color: white;
}

.manager-info::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 0;
    transform: translate(-10%, 2.5rem);
    background: var(--gradient-header);
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    white-space: nowrap;
    max-width: 200px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.team-list li:hover .manager-info::after {
    opacity: 1;
    visibility: visible;
}

/* --- Main Content --- */
.main-content {
    flex-grow: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
}

.main-content h2 {
    margin: 0 0 1.5rem 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    animation: fadeSlideUp 0.4s ease-out;
}

/* --- Filter Controls --- */
.filter-container {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    animation: fadeSlideUp 0.4s ease-out;
}

.filter-container > *,
.filter-container .autocomplete-container {
    flex: 1 1 200px;
    min-width: 200px;
    box-sizing: border-box;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    flex-basis: 100%;
    justify-content: flex-end;
}

.filter-container input,
.filter-container select {
    padding: 0.75rem 1rem;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
    font-family: inherit;
}

.filter-container input:focus,
.filter-container select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.filter-container input::placeholder {
    color: var(--text-muted);
}

/* --- Tags Filter Styles --- */
.tags-filter-container {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    order: 5;
}

#tagsFilterToggle {
    width: fit-content;
    max-width: 200px;
}

.filter-actions {
    order: 10;
}

.tags-filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 400px;
    max-width: 100%;
    margin-top: 0.5rem;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.available-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-filter-option {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tag-filter-option:hover {
    border-color: var(--accent-primary);
    background-color: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.tag-filter-option.selected {
    background: var(--gradient-accent);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.selected-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 0;
}

.selected-tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    background: var(--gradient-accent);
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    border: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.remove-selected-tag {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.remove-selected-tag:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* --- Buttons --- */
.btn-primary {
    background: var(--gradient-accent);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    padding: 0.7rem 1.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
    background: var(--gradient-accent);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
}

/* --- User Links --- */
a.user-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--accent-primary);
    transition: all 0.3s ease;
}

a.user-link:hover {
    color: var(--accent-primary);
    border-bottom: 1px solid var(--accent-primary);
}

/* --- Autocomplete Styles --- */
.autocomplete-container {
    position: relative;
}

.autocomplete-suggestions {
    display: none;
    position: absolute;
    border: 2px solid var(--border-color);
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    max-height: 150px;
    overflow-y: auto;
    border-radius: 0 0 12px 12px;
    box-shadow: var(--shadow-md);
}

.autocomplete-suggestions div {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.autocomplete-suggestions div:last-child {
    border-bottom: none;
}

.autocomplete-suggestions div:hover {
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    color: var(--accent-primary);
}

/* --- Ticket List & Cards --- */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeSlideUp 0.5s ease-out;
}

.ticket-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--bg-secondary);
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.ticket-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ticket-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.ticket-info {
    flex-grow: 1;
}

.ticket-info .title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    font-size: 1.05rem;
}

.badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.ticket-info .meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.ticket-info .meta strong {
    color: var(--text-secondary);
}

/* --- Priority Badges --- */
.priority {
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority.high { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.priority.medium { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.priority.low { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }

.team-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-primary);
    background-color: rgba(102, 126, 234, 0.1);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--accent-primary);
}

.app-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--priority-low);
    background-color: rgba(34, 197, 94, 0.1);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--priority-low);
}

.sev-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    border: 1px solid;
}

.sev-badge.sev-1 {
    color: var(--priority-high);
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--priority-high);
}
.sev-badge.sev-2 {
    color: var(--priority-medium);
    background-color: rgba(245, 158, 11, 0.1);
    border-color: var(--priority-medium);
}
.sev-badge.sev-3, .sev-badge.sev-4 {
    color: var(--accent-primary);
    background-color: rgba(102, 126, 234, 0.1);
    border-color: var(--accent-primary);
}
.sev-badge.sev-5 {
    color: var(--text-muted);
    background-color: rgba(137, 150, 166, 0.1);
    border-color: var(--text-muted);
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.remove-tag-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 0.4rem;
    padding: 0;
    line-height: 1;
    font-weight: bold;
    transition: color 0.2s ease;
}

.remove-tag-btn:hover {
    color: var(--priority-high);
}

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

.ticket-meta-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    flex-shrink: 0;
    text-align: right;
}

.deadline {
    font-weight: 600;
    color: var(--text-secondary);
}

.deadline.overdue {
    color: var(--priority-high);
}

/* --- Glowing Text Animations for List View Deadlines --- */
@keyframes glow-red {
    0% { text-shadow: 0 0 3px rgba(239, 68, 68, 0.6); }
    50% { text-shadow: 0 0 7px rgba(239, 68, 68, 0.9), 0 0 10px rgba(239, 68, 68, 0.7); }
    100% { text-shadow: 0 0 3px rgba(239, 68, 68, 0.6); }
}

@keyframes glow-amber {
    0% { text-shadow: 0 0 3px rgba(245, 158, 11, 0.6); }
    50% { text-shadow: 0 0 7px rgba(245, 158, 11, 0.9), 0 0 10px rgba(245, 158, 11, 0.7); }
    100% { text-shadow: 0 0 3px rgba(245, 158, 11, 0.6); }
}

@keyframes pulse-calendar-overdue {
    0% {
        background-color: rgba(239, 68, 68, 0.2);
        border-left-color: var(--priority-high);
    }
    50% {
        background-color: rgba(239, 68, 68, 0.1);
        border-left-color: rgba(239, 68, 68, 0.5);
    }
    100% {
        background-color: rgba(239, 68, 68, 0.2);
        border-left-color: var(--priority-high);
    }
}

.deadline.overdue {
    animation: glow-red 2s ease-in-out infinite;
}

.deadline.due-soon {
    animation: glow-amber 2s ease-in-out infinite;
}

.calendar-ticket.overdue {
    animation: pulse-calendar-overdue 2s infinite;
    background-color: rgba(239, 68, 68, 0.2);
    border-left-color: var(--priority-high);
}

.calendar-ticket.due-soon {
    background-color: rgba(245, 158, 11, 0.2);
    border-left-color: var(--priority-medium);
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(9, 28, 58, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 5% auto;
    padding: 2rem;
    border: none;
    width: 80%;
    max-width: 700px;
    border-radius: 20px;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.close-button {
    color: var(--text-muted);
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    user-select: none;
    pointer-events: auto;
    z-index: 100;
    line-height: 1;
    text-align: center;
}

.close-button:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

@media screen and (max-width: 768px) {
    .modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        left: 0 !important;
        top: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        position: fixed !important;
    }

    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow-y: auto !important;
        padding: 1.5rem !important;
        box-sizing: border-box !important;
    }

    .close-button {
        top: 1rem;
        right: 1rem;
        z-index: 10;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content refresh animation - triggered via JS when content changes */
.content-refresh {
    animation: fadeSlideUp 0.35s ease-out;
}

.content-refresh .ticket-list,
.content-refresh #calendarView,
.content-refresh #calendarContainer {
    animation: fadeSlideUp 0.4s ease-out;
}

/* --- Modal Forms & Editable Content --- */
.modal-content h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--bg-tertiary);
    padding-bottom: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
}

.modal-content h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--gradient-accent);
}

.modal-content .form-group {
    margin-bottom: 1.25rem;
}

.modal-content label {
    display: block;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.modal-content input[type="text"],
.modal-content select,
.modal-content textarea,
.modal-content input[type="number"],
.modal-content input[type="datetime-local"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.modal-content input[type="text"]:focus,
.modal-content select:focus,
.modal-content textarea:focus,
.modal-content input[type="number"]:focus,
.modal-content input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.modal-content input[type="datetime-local"] {
    color-scheme: light;
}

/* Priority-based border colors */
.ticket-card.type-ticket { border-left: 4px solid var(--type-ticket); }
.ticket-card.type-approval { border-left: 4px solid var(--type-approval); }
.ticket-card.type-task { border-left: 4px solid var(--type-task); }

/* Closed tickets styling */
.ticket-card.status-closed {
    background-color: var(--bg-tertiary);
    opacity: 0.7;
    border-left: 4px solid var(--text-muted);
    position: relative;
}

.ticket-card.status-closed::after {
    content: '✓ CLOSED';
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, rgba(137, 150, 166, 0.15) 0%, rgba(137, 150, 166, 0.25) 100%);
    color: var(--text-muted);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid var(--text-muted);
}

.ticket-card.status-closed:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}

.ticket-card.status-closed .title {
    color: var(--text-muted);
}

.ticket-card.status-closed::before {
    background: linear-gradient(135deg, var(--text-muted) 0%, var(--text-muted) 100%);
}

.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: bold;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.special-ui-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    padding: 1.25rem;
    border-radius: 12px;
    margin: 1rem 0;
    border: 1px dashed var(--border-color);
}

/* --- Enhanced Task List Styling --- */
.task-list-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: var(--shadow-sm);
}

.task-list-container h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 2px solid transparent;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.todo-item:hover {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.todo-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin-right: 12px;
    background: transparent;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.todo-item input[type="checkbox"]:checked {
    background: var(--gradient-accent);
    border-color: var(--accent-primary);
}

.todo-item input[type="checkbox"]:checked::after {
    content: '\2714';
    position: absolute;
    color: white;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.todo-item span {
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.todo-item input[type="checkbox"]:checked + span {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* --- Approval Cards --- */
.approval-details-wrapper {
    margin: 20px 0;
    padding-top: 10px;
}

.section-title {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.approval-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.approval-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

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

.card-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.card-value {
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-word;
    font-weight: 500;
}

.approval-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.approval-actions button {
    flex: 1;
}

/* --- Ticket Detail Specifics --- */
#ticketDetailContent hr {
    border: none;
    border-top: 2px solid var(--bg-tertiary);
    margin: 1.5rem 0;
}

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

.detail-item select {
    width: 100%;
}

.editable {
    padding: 0.5rem;
    border: 2px dashed transparent;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.editable:hover {
    border-color: var(--accent-hover);
    background-color: rgba(102, 126, 234, 0.05);
}

.editable[contenteditable="true"] {
    background-color: var(--bg-primary);
    border-color: var(--accent-primary);
    outline: none;
}

.tag-input-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-section, .attachment-section {
    margin-top: 1rem;
}

.deadline-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.duration-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

#durationDisplay {
    font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.duration-container .live-indicator {
    color: var(--priority-low);
    font-size: 1.5rem;
}

.comment, .attachment {
    background-color: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comment-actions button, .attachment-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 0.5rem;
    transition: color 0.2s ease;
}

.comment-actions button:hover, .attachment-actions button:hover {
    color: var(--accent-primary);
}

/* --- Inline Comment Editing/Deleting --- */
.comment-edit-form, .comment-confirmation {
    width: 100%;
}

.comment-edit-form textarea {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--bg-primary);
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    font-family: inherit;
}

.comment-edit-actions, .comment-confirmation-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
}

/* --- Custom File Upload Button --- */
.attachment-upload-label {
    display: inline-block;
    cursor: pointer;
}

#attachmentUpload {
    display: none;
}

/* --- Approval File Upload (Drop Zone) --- */
.file-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-primary);
    position: relative;
}

.file-drop-zone:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.file-drop-zone.drag-over {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.file-drop-zone .drop-zone-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.25rem;
}

.file-drop-zone p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.file-drop-zone .drop-zone-link {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: underline;
}

.file-drop-zone input[type="file"] {
    display: none;
}

.approval-file-list {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.approval-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 0.8rem;
}

.approval-file-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.approval-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.approval-file-size {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

.btn-icon:hover {
    color: var(--accent-primary);
}

/* --- Team Management Modal Specifics --- */
.btn-full-width {
    width: 100%;
    text-align: center;
}

.selected-members-list {
    margin-top: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    max-height: 150px;
    overflow-y: auto;
    background-color: var(--bg-primary);
}

.selected-member {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

/* --- SEV Settings Modal Tabs --- */
.modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--bg-tertiary);
    margin-bottom: 1.5rem;
}

.modal-tabs button {
    background: none;
    border: none;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.modal-tabs button:hover {
    color: var(--text-primary);
}

.modal-tabs button.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* --- Calendar Header & Nav --- */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-nav {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.3rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-nav:hover {
    background: var(--gradient-accent);
    border-color: transparent;
    color: white;
}

/* --- Calendar View Styles --- */
#calendarView {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: var(--border-color);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    animation: fadeSlideUp 0.5s ease-out;
}

.calendar-day {
    background-color: var(--bg-secondary);
    height: 120px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

.calendar-day.other-month {
    background-color: var(--bg-primary);
    color: var(--text-muted);
}

.calendar-day-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: right;
    color: var(--text-secondary);
}

.calendar-day.today .calendar-day-header {
    color: var(--accent-primary);
    font-weight: 700;
}

.calendar-tickets {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    flex-shrink: 1;
    min-height: 0;
    overflow: hidden;
    gap: 4px;
}

.calendar-ticket {
    background-color: var(--bg-tertiary);
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    width: 100%;
    text-overflow: ellipsis;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.calendar-ticket:hover {
    background-color: var(--border-color);
}

.calendar-ticket.high { border-left-color: var(--priority-high); }
.calendar-ticket.medium { border-left-color: var(--priority-medium); }
.calendar-ticket.low { border-left-color: var(--priority-low); }

.calendar-ticket.overdue {
    background-color: rgba(239, 68, 68, 0.15);
    border-left-color: var(--priority-high);
}

/* ==================== MEDIA SECTION STYLES ==================== */
.approval-media-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid var(--bg-tertiary);
}

.media-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.media-loading {
    color: var(--text-muted);
    font-style: italic;
    padding: 12px;
}

.approval-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.approval-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.approval-image-container:hover {
    transform: scale(1.05);
}

.approval-image-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.approval-image-container:hover .approval-image-thumb {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.approval-image-name {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.approval-docs-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.approval-doc-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.approval-doc-container:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.approval-doc-icon {
    font-size: 24px;
}

.approval-doc-name {
    color: var(--text-primary);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== MEDIA MODAL STYLES ==================== */
.media-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.media-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 28, 58, 0.7);
    backdrop-filter: blur(8px);
}

.media-modal-container {
    position: relative;
    z-index: 1;
    background: var(--bg-secondary);
    border-radius: 20px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: none;
}

.media-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 2px solid var(--bg-tertiary);
}

.media-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.media-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.media-modal-close:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.media-modal-body {
    padding: 20px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-fullsize-image {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
}

.modal-document-preview {
    text-align: center;
    padding: 40px;
}

.doc-preview-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.doc-preview-name {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.doc-download-btn {
    display: inline-block;
    padding: 14px 36px;
    background: var(--gradient-accent);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-accent);
}

.doc-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

body.modal-open {
    overflow: hidden;
}

/* --- Modal Footer --- */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--bg-tertiary);
}

/* --- Flatpickr Custom Styles (Light Theme) --- */
.flatpickr-calendar {
    background: var(--bg-secondary) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: "Poppins", sans-serif !important;
}

.flatpickr-months {
    background: var(--gradient-header) !important;
    border-radius: 14px 14px 0 0 !important;
    padding: 8px 0 !important;
}

.flatpickr-months .flatpickr-month {
    background: transparent !important;
    color: white !important;
    fill: white !important;
}

.flatpickr-current-month {
    color: white !important;
    font-weight: 600 !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    color: white !important;
    font-weight: 600 !important;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: white !important;
    fill: white !important;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    color: rgba(255, 255, 255, 0.7) !important;
}

.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
    fill: white !important;
}

.flatpickr-weekdays {
    background: var(--bg-tertiary) !important;
}

.flatpickr-weekday {
    color: var(--text-secondary) !important;
    font-weight: 600 !important;
}

.flatpickr-days {
    background: var(--bg-secondary) !important;
}

.flatpickr-day {
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
}

.flatpickr-day:hover {
    background: var(--bg-tertiary) !important;
    border-color: transparent !important;
}

.flatpickr-day.today {
    border-color: var(--accent-primary) !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--gradient-accent) !important;
    border-color: transparent !important;
    color: white !important;
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--text-muted) !important;
}

.flatpickr-time {
    background: var(--bg-secondary) !important;
    border-top: 1px solid var(--border-color) !important;
}

.flatpickr-time input {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
}

.flatpickr-time .flatpickr-am-pm {
    color: var(--text-primary) !important;
    background: var(--bg-tertiary) !important;
    border-radius: 8px !important;
}

.flatpickr-time .flatpickr-am-pm:hover {
    background: var(--accent-primary) !important;
    color: white !important;
}

.numInputWrapper:hover {
    background: var(--bg-tertiary) !important;
}

.numInputWrapper span {
    border-color: var(--border-color) !important;
}

.numInputWrapper span:hover {
    background: var(--accent-primary) !important;
}

.numInputWrapper span:after {
    border-color: var(--text-primary) !important;
}

/* ==================== RESPONSIVE DESIGN ==================== */

/* Large tablets and below (1053px and below) - Button wrapping */
@media screen and (max-width: 1053px) {
    .app-header {
        flex-wrap: wrap;
        min-height: auto;
    }

    .header-left {
        flex: 1;
        justify-content: space-between;
    }

    #newTicketBtn {
        flex-basis: 100%;
        width: 100%;
        margin-top: 0.5rem;
        order: 3;
    }

    .app-container {
        height: auto;
        min-height: calc(100vh - 110px);
    }
}

/* Tablets and below (992px) */
@media screen and (max-width: 992px) {
    /* Header responsive styles */
    .app-header {
        padding: 0.9rem 1.25rem;
    }

    .header-left {
        gap: 1.25rem;
    }

    .app-header h1 {
        font-size: 1.4rem;
    }

    .header-logo {
        width: 36px;
        height: 36px;
    }


    #newTicketBtn {
        padding: 0.65rem 1.25rem;
        font-size: 0.85rem;
    }

    .view-switcher button {
        padding: 0.45rem 0.9rem;
        font-size: 0.95rem;
    }

    .language-switcher label {
        font-size: 0.8rem;
    }

    .language-switcher select {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }

    .main-content {
        padding: 1.25rem;
    }

    .filter-container {
        gap: 0.5rem;
    }

    .filter-container > *,
    .filter-container .autocomplete-container {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: calc(50% - 0.25rem);
    }

    .tags-filter-container {
        flex: 0 0 100%;
        width: 100%;
        order: 5;
    }

    .filter-actions {
        flex: 0 0 100%;
        width: 100%;
        order: 10;
    }

    .ticket-card {
        padding: 1rem 1.25rem;
    }

    .badge-container {
        gap: 0.4rem;
    }

    .priority, .team-badge, .app-badge, .sev-badge, .tag-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
    }
}

/* Mobile landscape and small tablets (768px and below) */
@media screen and (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .main-content h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .filter-container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-container > *,
    .filter-container .autocomplete-container {
        flex: 1 1 100%;
        min-width: 100%;
        width: 100%;
    }

    .tags-filter-container {
        flex: 0 0 100%;
        width: 100%;
        order: 5;
    }

    #tagsFilterToggle {
        max-width: 100%;
    }

    .tags-filter-dropdown {
        width: 100%;
    }

    .filter-actions {
        flex: 0 0 100%;
        flex-direction: row;
        gap: 0.5rem;
        order: 10;
    }

    .filter-actions button {
        flex: 1;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .ticket-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        gap: 0.75rem;
    }

    .ticket-info .title {
        font-size: 0.95rem;
    }

    .ticket-info .meta {
        font-size: 0.8rem;
    }

    .ticket-meta-right {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .badge-container {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .modal-content {
        padding: 1.5rem;
        width: 90%;
    }

    .modal-content h2 {
        font-size: 1.4rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .btn-primary, .btn-secondary {
        padding: 0.65rem 1.25rem;
        font-size: 0.85rem;
    }

    .calendar-day {
        height: 100px;
        padding: 0.4rem;
    }

    .calendar-day-header {
        font-size: 0.85rem;
    }

    .calendar-ticket {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }
}

/* Mobile portrait (600px and below) */
@media screen and (max-width: 600px) {
    .app-header {
        padding: 0.75rem 1rem;
    }

    .header-left {
        gap: 0.5rem;
    }

    .hamburger-menu {
        font-size: 1.1rem;
        padding: 0.35rem 0.5rem;
    }

    .app-header h1 {
        font-size: 1.2rem;
    }

    .header-logo {
        width: 30px;
        height: 30px;
    }


    #newTicketBtn {
        padding: 0.45rem 0.75rem;
        font-size: 0.7rem;
    }

    .view-switcher {
        padding: 2px;
    }

    .view-switcher button {
        padding: 0.35rem 0.65rem;
        font-size: 0.8rem;
    }

    .language-switcher select {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }

    .switch {
        width: 42px;
        height: 24px;
    }

    .slider:before {
        height: 16px;
        width: 16px;
    }

    input:checked + .slider:before {
        transform: translateX(18px);
    }

    .main-content {
        padding: 0.75rem;
    }

    .main-content h2 {
        font-size: 1.3rem;
    }

    .ticket-card {
        padding: 0.875rem;
        border-radius: 12px;
    }

    .ticket-info .title {
        font-size: 0.9rem;
        line-height: 1.3;
    }

    .type-badge {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    .priority, .team-badge, .app-badge, .sev-badge, .tag-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.25rem 1.25rem 3.5rem 1.25rem;
    }

    .modal-content h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .modal-content label {
        font-size: 0.85rem;
    }

    .modal-content input[type="text"],
    .modal-content select,
    .modal-content textarea {
        font-size: 0.9rem;
        padding: 0.65rem 0.85rem;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        padding: 0.7rem 1rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .modal-footer button {
        width: 100%;
        margin-left: 0 !important;
    }

    .modal-content::after {
        content: '';
        display: block;
        height: 4rem;
        width: 100%;
    }

    .calendar-header h3 {
        font-size: 1.1rem;
    }

    .calendar-nav {
        padding: 0.2rem 0.75rem;
        font-size: 1.3rem;
    }

    .calendar-day {
        height: 80px;
        padding: 0.3rem;
    }

    .calendar-day-header {
        font-size: 0.75rem;
    }

    .calendar-ticket {
        font-size: 0.65rem;
        padding: 0.2rem 0.3rem;
    }
}

/* Small mobile (480px and below) */
@media screen and (max-width: 480px) {
    .app-header {
        padding: 0.6rem 0.75rem;
    }

    .header-left {
        gap: 0.4rem;
    }

    .hamburger-menu {
        font-size: 1rem;
        padding: 0.3rem 0.45rem;
    }

    .app-header h1 {
        font-size: 1.1rem;
    }

    .header-logo {
        width: 28px;
        height: 28px;
    }


    #newTicketBtn {
        padding: 0.4rem 0.6rem;
        font-size: 0.65rem;
    }

    .view-switcher {
        padding: 2px;
    }

    .view-switcher button {
        padding: 0.25rem 0.45rem;
        font-size: 0.75rem;
    }

    .language-switcher select {
        padding: 0.25rem 0.45rem;
        font-size: 0.65rem;
    }

    .switch {
        width: 40px;
        height: 22px;
    }

    .slider:before {
        height: 14px;
        width: 14px;
    }

    input:checked + .slider:before {
        transform: translateX(18px);
    }

    .sidebar {
        width: 260px;
        padding: 1rem;
    }

    .sidebar h3 {
        font-size: 0.7rem;
    }

    .nav-list li, .team-list li {
        padding: 0.6rem 0.85rem;
        font-size: 0.9rem;
    }

    .main-content {
        padding: 0.6rem;
    }

    .main-content h2 {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }

    .ticket-card {
        padding: 0.75rem;
        border-radius: 10px;
    }

    .ticket-card::before {
        width: 3px;
    }

    .ticket-info .title {
        font-size: 0.85rem;
    }

    .ticket-info .meta {
        font-size: 0.75rem;
    }

    .badge-container {
        gap: 0.3rem;
    }

    .priority, .team-badge, .app-badge, .sev-badge, .tag-badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.45rem;
    }

    .modal-content {
        width: 100%;
        padding: 1rem;
        border-radius: 12px;
    }

    .modal-content h2 {
        font-size: 1.15rem;
    }

    .close-button {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .btn-primary, .btn-secondary {
        padding: 0.6rem 0.9rem;
        font-size: 0.8rem;
    }

    .calendar-day {
        height: 70px;
        padding: 0.25rem;
    }

    .calendar-day-header {
        font-size: 0.7rem;
        margin-bottom: 0.3rem;
    }

    .calendar-ticket {
        font-size: 0.6rem;
        padding: 0.15rem 0.25rem;
        border-radius: 4px;
    }
}

/* Small mobile with button wrapping (400px and below) */
@media screen and (max-width: 400px) {
    .app-header {
        flex-wrap: wrap;
        min-height: auto;
    }

    #newTicketBtn {
        flex-basis: 100%;
        width: 100%;
        margin-top: 0.5rem;
        order: 3;
    }

    .app-container {
        height: auto;
        min-height: calc(100vh - 100px);
    }
}

/* Extra small devices (360px and below) */
@media screen and (max-width: 360px) {
    .app-header {
        padding: 0.5rem 0.6rem;
    }

    .header-left {
        gap: 0.25rem;
    }

    .hamburger-menu {
        font-size: 0.9rem;
        padding: 0.25rem 0.4rem;
    }

    .app-header h1 {
        font-size: 1rem;
    }

    .header-logo {
        width: 24px;
        height: 24px;
    }


    #newTicketBtn {
        padding: 0.35rem 0.5rem;
        font-size: 0.6rem;
    }

    .view-switcher {
        padding: 2px;
    }

    .view-switcher button {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }

    .language-switcher select {
        padding: 0.2rem 0.4rem;
        font-size: 0.6rem;
    }

    .switch {
        width: 38px;
        height: 20px;
    }

    .slider:before {
        height: 12px;
        width: 12px;
        left: 4px;
        bottom: 4px;
    }

    input:checked + .slider:before {
        transform: translateX(18px);
    }

    .sidebar {
        width: 240px;
        padding: 0.85rem;
    }

    .main-content {
        padding: 0.5rem;
    }

    .main-content h2 {
        font-size: 1.1rem;
    }

    .ticket-card {
        padding: 0.65rem;
    }

    .ticket-info .title {
        font-size: 0.8rem;
    }

    .priority, .team-badge, .app-badge, .sev-badge, .tag-badge {
        font-size: 0.55rem;
        padding: 0.15rem 0.4rem;
    }

    .modal-content {
        padding: 0.85rem;
    }

    .calendar-day {
        height: 60px;
        padding: 0.2rem;
    }

    .calendar-day-header {
        font-size: 0.65rem;
    }

    .calendar-ticket {
        font-size: 0.55rem;
        padding: 0.1rem 0.2rem;
    }
}
