/* Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 240px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: var(--text-white);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo svg {
    width: 20px;
    height: 20px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.sidebar-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-menu {
    list-style: none;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.menu-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.menu-item-link:hover, .menu-item.active .menu-item-link {
    color: var(--primary);
    background-color: var(--primary-light);
}

.menu-item-link svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-surface-nested);
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background-color: var(--primary);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    flex-grow: 1;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.btn-logout-icon {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.btn-logout-icon:hover {
    background-color: var(--danger-light);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: 240px;
    padding: 24px;
    min-width: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 20px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-description {
    font-size: 13px;
    color: var(--text-muted);
}

/* Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon-pending { background-color: var(--warning-light); color: var(--warning); }
.stat-icon-progress { background-color: var(--info-light); color: var(--info); }
.stat-icon-completed { background-color: var(--success-light); color: var(--success); }
.stat-icon-all { background-color: var(--primary-light); color: var(--primary); }

/* Control & Filter Bar */
.control-bar {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.filter-form .form-control {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.filter-form .btn {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.search-group {
    flex: 2;
    min-width: 250px;
}

.filter-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Requests Table Panel */
.table-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.data-table th {
    background-color: var(--bg-surface-nested);
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table .badge {
    padding: 3px 8px;
    font-size: 11px;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

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

.ticket-cell {
    font-family: monospace;
    font-weight: 700;
    color: var(--primary);
}

.title-cell {
    font-weight: 600;
}

.project-cell {
    font-weight: 500;
    color: var(--text-muted);
}

.date-cell {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.action-cell {
    white-space: nowrap;
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

/* Detail & Timeline Layout */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.panel-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Ticket Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.info-item {
    border-bottom: 1px solid var(--bg-surface-nested);
    padding-bottom: 12px;
}

.info-item-full {
    grid-column: span 2;
}

.info-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.info-value {
    font-size: 14px;
    font-weight: 500;
}

.raw-message-box {
    background-color: var(--bg-surface-nested);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Dynamic Items Table */
.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 10px;
}

.items-table th {
    text-align: left;
    padding: 10px;
    background-color: var(--bg-surface-nested);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
}

.items-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
}

.items-table input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background-color: var(--bg-surface);
    color: var(--text-main);
}

/* Timeline/Logs Styling */
.timeline {
    position: relative;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 7px;
    bottom: 5px;
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
}

.timeline-marker {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    background-color: var(--bg-surface);
    border: 2px solid var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.timeline-item-system .timeline-marker {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.timeline-item-comment .timeline-marker {
    border-color: var(--success);
    background-color: var(--success-light);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 10px;
}

.timeline-user {
    font-size: 13px;
    font-weight: 600;
}

.timeline-time {
    font-size: 11px;
    color: var(--text-muted);
}

.timeline-body {
    font-size: 13px;
    color: var(--text-main);
    background-color: var(--bg-surface-nested);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    word-break: break-word;
}

.timeline-item-system .timeline-body {
    border-left: 3px solid var(--primary);
    background-color: var(--bg-app);
}

/* Attachments Panel */
.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.attachment-card {
    background-color: var(--bg-surface-nested);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
    text-align: center;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
    transition: transform var(--transition-fast);
}

.attachment-card:hover {
    transform: scale(1.02);
}

.attachment-preview {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    font-size: 24px;
    background-color: var(--bg-surface);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
    margin-bottom: 4px;
    padding: 0 4px;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar-title, .sidebar-subtitle, .user-info, .sidebar-header span {
        display: none;
    }
    
    .sidebar-header {
        justify-content: center;
        padding: 16px 8px;
    }
    
    .menu-item-link {
        justify-content: center;
        padding: 12px 0;
    }
    
    .menu-item-link span {
        display: none;
    }
    
    .sidebar-footer {
        padding: 16px 0;
        justify-content: center;
    }
    
    .user-profile-widget {
        justify-content: center;
    }
    
    .user-avatar {
        margin: 0 auto;
    }
    
    .btn-logout-icon {
        display: none;
    }
    
    .main-content {
        margin-left: 70px;
        padding: 20px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .info-item-full {
        grid-column: span 1;
    }
}
