/* BugTracker Pro - Main Stylesheet */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --light: #f8fafc;
    --dark: #1e293b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f1f5f9;
    color: var(--dark);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--dark);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-header span {
    font-size: 0.75rem;
    color: var(--secondary);
}

.sidebar-nav {
    padding: 15px 0;
}

.nav-section {
    padding: 10px 20px 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--secondary);
    letter-spacing: 0.5px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #cbd5e1;
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.header {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

/* Header Search Bar */
.header-search {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.header-search-form {
    display: flex;
    position: relative;
}

.header-search-input {
    width: 100%;
    padding: 8px 40px 8px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #f8fafc;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.header-search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.header-search-input::placeholder {
    color: #94a3b8;
}

.header-search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 1rem;
}

.content {
    padding: 30px;
}

/* Page Title */
.page-title {
    margin-bottom: 25px;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
}

.page-title p {
    color: var(--secondary);
    font-size: 0.9rem;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    background: var(--light);
}

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

.stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.stat-card .stat-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    color: var(--secondary);
    font-size: 0.85rem;
    margin-top: 5px;
}

.stat-card.primary .stat-icon { background: var(--primary); }
.stat-card.success .stat-icon { background: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning); }
.stat-card.danger .stat-icon { background: var(--danger); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-support {
    background: #7c3aed;
    color: white;
}

.btn-support:hover {
    background: #6d28d9;
    color: white;
}

.btn-task {
    background: #b45309;
    color: white;
}

.btn-task:hover {
    background: #92400e;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

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

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: #94a3b8;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-text {
    font-size: 0.8rem;
    color: var(--secondary);
    margin-top: 5px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--light);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary { background: #dbeafe; color: #1d4ed8; }
.badge-secondary { background: #f1f5f9; color: #64748b; }
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-info { background: #cffafe; color: #0891b2; }
.badge-support { background: #f3e8ff; color: #7c3aed; }
.badge-task { background: #fef3c7; color: #b45309; }
.badge-improvement { background: #d1fae5; color: #047857; }

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Ticket Details */
.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.ticket-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.ticket-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    color: var(--secondary);
    font-size: 0.9rem;
}

.ticket-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ticket-description {
    background: var(--light);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    white-space: pre-wrap;
}

/* Comments */
.comment-list {
    margin-top: 20px;
}

.comment {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.comment:last-child {
    border-bottom: none;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
    align-items: center;
}

.comment-author {
    font-weight: 600;
}

.comment-date {
    color: var(--secondary);
    font-size: 0.85rem;
}

.comment-text {
    color: var(--dark);
}

/* Attachments */
.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--light);
    border-radius: 6px;
    font-size: 0.85rem;
}

.attachment-item svg {
    width: 18px;
    height: 18px;
    color: var(--secondary);
}

/* Notifications */
.notification-badge {
    position: relative;
}

.notification-badge .count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 1000;
    display: none;
}

.notification-dropdown.show {
    display: block;
}

.notification-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    display: block;
    color: var(--dark);
}

.notification-item:hover {
    background: var(--light);
    text-decoration: none;
}

.notification-item.unread {
    background: #eff6ff;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
}

.user-menu:hover {
    background: var(--light);
}

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

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

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 1.75rem;
    margin-bottom: 5px;
}

.auth-header p {
    color: var(--secondary);
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light);
    border-radius: var(--radius);
}

.filters .form-control {
    width: auto;
    min-width: 150px;
}

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

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    color: var(--dark);
}

.pagination a:hover {
    background: var(--light);
    text-decoration: none;
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-upload:hover {
    border-color: var(--primary);
}

.file-upload input {
    display: none;
}

.file-upload-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 15px;
    color: var(--secondary);
}

.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--light);
    border-radius: 6px;
    font-size: 0.85rem;
}

.file-preview-item .remove {
    color: var(--danger);
    cursor: pointer;
}

/* Activity Log */
.activity-list {
    position: relative;
    padding-left: 25px;
}

.activity-list::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.activity-item {
    position: relative;
    padding-bottom: 20px;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -21px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--secondary);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
        transition: transform 0.3s;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: block !important;
    }
    
    .header {
        padding: 10px 15px;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filters .form-control {
        width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .card {
        border-radius: 8px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .card-header .btn {
        width: 100%;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    /* Mobile ticket list improvements */
    .ticket-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ticket-meta {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Mobile notification dropdown */
    .notification-dropdown {
        right: -50px;
        width: calc(100vw - 30px);
        max-width: 350px;
    }
    
    /* Mobile header improvements */
    .header-left {
        flex: 1;
    }
    
    .header-search {
        display: none;
    }
    
    .header-right {
        gap: 10px;
    }
    
    .user-info span {
        display: none;
    }
    
    /* Hide less important columns on mobile */
    .hide-mobile {
        display: none;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    
    .table th:nth-child(n+4),
    .table td:nth-child(n+4) {
        display: none;
    }
    
    .notification-dropdown {
        right: -80px;
    }
    
    .form-control {
        padding: 10px 12px;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar.open + .sidebar-overlay {
    display: block;
}

/* Touch-friendly improvements */
@media (hover: none) {
    .btn:active {
        transform: scale(0.98);
    }
    
    .nav-link:active {
        background: rgba(255,255,255,0.15);
    }
    
    .todo-delete-btn {
        opacity: 1;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--secondary); }
.mb-0 { margin-bottom: 0; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: nowrap;
}

.action-buttons .btn {
    padding: 5px 8px;
    min-width: auto;
}

.action-buttons form {
    display: inline;
    margin: 0;
}
