/* JG CRM Ticketing System - Main Stylesheet */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-color: #334155;
    --text-muted: #94a3b8;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

/* Navigation */
.navbar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-brand {
    padding: 1rem 2rem;
    border-right: 1px solid var(--border-color);
    display: inline-block;
}

.nav-brand h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
}

.nav-menu {
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

.nav-link {
    padding: 1.25rem 1rem;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    color: white;
    text-decoration: none;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Dashboard */
.dashboard {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--light-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.dashboard-section {
    margin-top: 2rem;
}

.dashboard-section h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

/* Status and Priority Displays */
.status-list {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--light-color);
    border-radius: 0.25rem;
}

.status-count {
    font-weight: 600;
}

.priority-chart {
    margin-top: 1rem;
}

.priority-bar {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.bar-label {
    width: 100px;
    font-weight: 500;
}

.bar-fill {
    background: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    color: white;
    font-size: 0.875rem;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th {
    background: var(--light-color);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover {
    background: var(--light-color);
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

/* Badges */
.status-badge, .priority-badge, .type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-new { background: #dbeafe; color: #1e40af; }
.status-triaged { background: #fef3c7; color: #92400e; }
.status-in_progress { background: #ddd6fe; color: #5b21b6; }
.status-awaiting_customer { background: #fed7aa; color: #9a3412; }
.status-review_testing { background: #fde68a; color: #78350f; }
.status-resolved { background: #d1fae5; color: #065f46; }
.status-closed { background: #e5e7eb; color: #4b5563; }

.priority-low { background: #f0f9ff; color: #0369a1; }
.priority-medium { background: #fef3c7; color: #92400e; }
.priority-high { background: #fed7aa; color: #9a3412; }
.priority-critical { background: #fee2e2; color: #991b1b; }
.priority-urgent { background: #fce7f3; color: #9f1239; }

.type-bug { background: #fee2e2; color: #991b1b; }
.type-feature { background: #dbeafe; color: #1e40af; }

/* Forms */
.form-section {
    background: white;
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-section h3 {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.radio-group {
    display: flex;
    gap: 2rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: #1d4ed8;
}

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

.btn-outline {
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-action {
    padding: 0.25rem 0.75rem;
    margin: 0 0.25rem;
    font-size: 0.75rem;
    color: var(--primary-color);
    text-decoration: none;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Filters */
.filter-section {
    background: white;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-form {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

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

.filter-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Ticket View */
.ticket-header {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.ticket-number {
    color: var(--primary-color);
    font-weight: 600;
    margin-right: 1rem;
}

.ticket-badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.ticket-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

.ticket-main {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ticket-sidebar {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.ticket-section {
    margin-bottom: 2rem;
}

.ticket-section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    padding: 0.75rem;
    background: var(--light-color);
    border-radius: 0.25rem;
}

.detail-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

/* Comments */
.comment-form {
    margin-bottom: 2rem;
}

.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    resize: vertical;
}

.comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.comments-list {
    margin-top: 1.5rem;
}

.comment {
    padding: 1rem;
    background: var(--light-color);
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.comment.internal {
    background: #fef3c7;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.comment-date {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.badge-internal {
    background: var(--warning-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

/* Activity Log */
.activity-log {
    margin-top: 1rem;
}

.activity-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.activity-time {
    color: var(--text-muted);
    margin-right: 1rem;
}

.activity-user {
    font-weight: 500;
    margin-right: 0.5rem;
}

/* Sidebar Details */
.sidebar-section h4 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.sidebar-section dl {
    font-size: 0.875rem;
}

.sidebar-section dt {
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.sidebar-section dd {
    margin-top: 0.25rem;
    color: var(--text-color);
}

.tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
}

.login-form .form-group {
    margin-bottom: 1rem;
}

.btn-block {
    width: 100%;
    padding: 0.75rem;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    color: var(--dark-color);
}

/* Quick Actions */
.quick-actions {
    margin-top: 2rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-page {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    text-decoration: none;
    color: var(--text-color);
}

.btn-page:hover {
    background: var(--light-color);
}

.page-info {
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        align-items: start;
    }

    .nav-user {
        margin-left: 0;
        margin-top: 1rem;
    }

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

    .ticket-content {
        grid-template-columns: 1fr;
    }

    .filter-form {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }
}