/* =========================
    GLOBAL STYLES
========================= */

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #f4f6f9;
    margin: 0;
    padding: 0;
    color: #1f2937;
    display: grid;
    flex-direction: column;
    min-height: 100vh; /* Expands to 100% of the viewport height */
    grid-template-rows: auto 1fr auto; /* 1fr forces the middle to stretch */
    margin: 0;
    
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    margin-bottom: 0;
}

p {
    margin-top: 0;
}

a {
    transition: 0.2s ease;
}

/* =========================
    LAYOUT
========================= */

.container {
    max-width: 1200px;
    width: 100%;
    margin: 32px auto;
    padding: 0 20px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.page-header p {
    color: #6b7280;
    margin-top: 0;
    font-size: 15px;
    line-height: 1.6;
}

.welcome {
    margin-bottom: 24px;
}

.welcome h2 {
    font-size: 30px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.welcome p {
    color: #6b7280;
    font-size: 15px;
}

/* =========================
    LOGIN PAGE
========================= */

/* 1. Override the global grid and force a vertical stack */
body.login-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background-color: #f4f7f6; /* Soft light gray background */
}

/* 2. The wrapper stretches to fill all empty space, pushing the footer down */
body.login-page .login-wrapper {
    flex: 1; 
    display: flex;
    align-items: center;        /* Centers vertically */
    justify-content: center;    /* Centers horizontally */
    width: 100%;
}



.login-container {
    width: 100%;
    max-width: 420px;
    margin:  auto;
    background: #fff;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 28px;
    color: #111827;
}

.demo-note {
    margin-top: 16px;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

/* =========================
    FORM ELEMENTS
========================= */

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
}


input[type="email"],
input[type="number"],
input[type="password"],
input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #111827;
    transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.checkbox-group {
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    color: #374151;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

/* =========================
   BUTTONS
========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 18px;
    background: #2563eb;
    border: none;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
}

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

.btn-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    text-decoration: none;
    padding: 11px 18px;
    margin-top: 0;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
    box-shadow: none;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

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

.page-actions {
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.page-actions .btn-inline {
    margin-top: 0;
}

/* =========================
   ALERTS
========================= */

.error {
    background: #fef2f2;
    color: #991b1b;
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    border: 1px solid #fecaca;
}

.success {
    background: #ecfdf5;
    color: #065f46;
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    border: 1px solid #a7f3d0;
}

/* =========================
   NAVBAR
========================= */

.navbar {
    background: #1f2937;
    color: #fff;
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.navbar strong {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.navbar > div:last-child {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.nav-user,
.navbar span {
    color: #d1d5db;
    font-size: 14px;
    margin-right: 6px;
    font-weight: 500;
}

.navbar a {
    color: #e5e7eb;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.95;
    margin-left: 0;
}

.navbar a:hover {
    opacity: 1;
    color: #93c5fd;
}

.active-nav {
    color: #93c5fd !important;
    font-weight: 700;
}

/* =========================
    DASHBOARD
========================= */

.dashboard-hero {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: #fff;
    border-radius: 18px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 12px 30px rgba(31, 41, 55, 0.12);
}

.dashboard-hero h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.dashboard-hero p {
    margin: 0;
    color: #e5e7eb;
    font-size: 15px;
    line-height: 1.6;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
}

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

.card {
    background: #ffffff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #eef2f7;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.09);
}

.card-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 18px;
}

.card-icon {
    min-width: 72px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    background: #f3f4f6;
    color: #374151;
}

.card-number {
    font-size: 40px;
    font-weight: 800;
    color: #111827;
    line-height: 1;
    margin: 0 0 10px;
}

.card-label {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
    line-height: 1.2;
}

.card-subtext {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

.card.open {
    border-left: 5px solid #2563eb;
}

.card.open .card-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.card.progress {
    border-left: 5px solid #f59e0b;
}

.card.progress .card-icon {
    background: #fef3c7;
    color: #92400e;
}

.card.resolved {
    border-left: 5px solid #10b981;
}

.card.resolved .card-icon {
    background: #d1fae5;
    color: #065f46;
}

.card.closed {
    border-left: 5px solid #6b7280;
}

.card.closed .card-icon {
    background: #e5e7eb;
    color: #374151;
}

.card.total {
    border-left: 5px solid #7c3aed;
}

.card.total .card-icon {
    background: #ede9fe;
    color: #6d28d9;
}

.quick-actions-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #eef2f7;
    margin-top: 28px;
}

.quick-actions-card h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #111827;
}

.quick-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* =========================
   FORMS / CONTENT CARDS
========================= */

.form-card,
.table-card,
.details-card {
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #eef2f7;
}

.form-card {
    max-width: 760px;
}

.details-card {
    margin-bottom: 20px;
}

/* =========================
   TABLES
========================= */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e9ecef;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #374151;
}

.data-table tr:hover td {
    background: #fafcff;
}

.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: #6b7280;
}

/* =========================
   BADGES
========================= */

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-open {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-progress {
    background: #fef3c7;
    color: #92400e;
}

.badge-pending {
    background: #fee2e2;
    color: #991b1b;
}

.badge-resolved {
    background: #d1fae5;
    color: #065f46;
}

.badge-closed {
    background: #e5e7eb;
    color: #374151;
}

.badge-reopened {
    background: #ede9fe;
    color: #6d28d9;
}

.badge-low {
    background: #dcfce7;
    color: #166534;
}

.badge-medium {
    background: #cffafe;
    color: #155e75;
}

.badge-high {
    background: #fde68a;
    color: #92400e;
}

.badge-critical {
    background: #fecaca;
    color: #991b1b;
}

.badge-overdue {
    background: #fee2e2;
    color: #991b1b;
}


/* =========================
   MODALS (POPUPS)
========================= */
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6); /* Dark semi-transparent background */
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(4px); /* Adds a nice modern blur effect */
}

/* When the modal is active, change display to flex to center it */
.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-width: 760px;
    border-radius: 16px;
    padding: 0; /* Removing padding here so the form-card fits flush */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

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

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #111827;
}

.modal-content.modal-wide {
    max-width: 1000px;
    max-height: 95vh; /* Gives a bit more vertical breathing room */
    background: #f8fafc; /* So the inner white cards stand out */
}

.badge-ontrack {
    background: #dcfce7;
    color: #166534;
}


/* =========================
   DETAILS / COMMENTS
========================= */

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ticket-code {
    margin: 6px 0 0;
    color: #6b7280;
    font-size: 14px;
}

.details-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.detail-item strong {
    display: block;
    margin-bottom: 6px;
    color: #374151;
}

.detail-item p {
    margin: 0;
    color: #111827;
}

.detail-section {
    margin-top: 20px;
}

.detail-section strong {
    display: block;
    margin-bottom: 8px;
    color: #374151;
}

.detail-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    padding: 14px;
    border-radius: 10px;
    line-height: 1.6;
}

.comments-list {
    margin-top: 15px;
}

.comment-item {
    border-bottom: 1px solid #e9ecef;
    padding: 14px 0;
}

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

.comment-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    font-size: 14px;
    color: #6b7280;
}

.comment-text {
    line-height: 1.6;
}

.muted-text {
    color: #6b7280;
}

/* =========================
   FOOTER
========================= */

.site-footer {
    margin-top: 48px;
    background: #1f2937;
    color: #fff;
    padding: 24px 0;
    text-align: center;
}

.footer-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-footer p {
    margin: 4px 0;
}

.footer-subtext {
    font-size: 13px;
    color: #d1d5db;
}

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

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        margin: 20px auto;
        padding: 0 14px;
    }

    .navbar {
        padding: 14px 16px;
        align-items: flex-start;
        flex-direction: column;
    }

    .navbar > div:first-child {
        margin-bottom: 10px;
    }

    .navbar > div:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 10px 12px;
        width: 100%;
    }

    .nav-user {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 6px;
        font-size: 13px;
    }

    .navbar strong {
        font-size: 20px;
    }

    .navbar a {
        font-size: 14px;
    }

    .dashboard-hero {
        padding: 22px;
    }

    .dashboard-hero h2,
    .page-header h2,
    .welcome h2 {
        font-size: 26px;
        line-height: 1.25;
    }

    .dashboard-hero p,
    .page-header p,
    .welcome p {
        font-size: 14px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .filter-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .page-actions,
    .quick-actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .page-actions .btn,
    .page-actions .btn-inline,
    .page-actions button,
    .page-actions a,
    .quick-actions-row .btn,
    .quick-actions-row .btn-inline,
    .quick-actions-row button,
    .quick-actions-row a {
        width: 100%;
    }

    .form-card,
    .table-card,
    .details-card,
    .login-container {
        padding: 18px;
        border-radius: 14px;
    }

    .details-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .comment-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .card {
        min-height: auto;
        padding: 16px;
    }

    .card-number {
        font-size: 32px;
    }

    .card-label {
        font-size: 20px;
    }

    .card .page-actions {
        margin-top: 16px;
    }

    .card .page-actions .btn-inline {
        width: 100%;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 14px;
    }

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

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

    .page-header h2,
    .welcome h2,
    .dashboard-hero h2 {
        font-size: 22px;
    }

    .navbar strong {
        font-size: 20px;
    }

    .card-number {
        font-size: 24px;
    }

    .card-label {
        font-size: 18px;
    }

    .btn,
    .btn-inline {
        padding: 11px 14px;
        font-size: 14px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
}

/* =========================
   PRINT
========================= */

@media print {
    .no-print,
    .navbar,
    .site-footer {
        display: none !important;
    }

    body {
        background: #ffffff;
    }

    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .dashboard-grid {
        gap: 12px;
    }

    .card,
    .table-card,
    .form-card {
        box-shadow: none;
        border: 1px solid #d1d5db;
    }

    .page-header h2 {
        font-size: 24px;
    }
}


/* =========================
   Pagination
========================= */

/* 1. THE MAIN WRAPPER (This fixes the Left/Right split) */
.pagination-wrapper {
    display: flex;
    justify-content: space-between; /* Text on left, buttons on right */
    align-items: center;
    margin-top: 24px;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

/* 2. THE CONTROLS CONTAINER (Keeps buttons and form side-by-side) */
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* 3. YOUR ORIGINAL BUTTONS (Fixed margin to align properly) */
.pagination {
    margin: 0 ; /* Removed the 20px margin so it aligns with the Go To box */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #1f2937;
    text-decoration: none;
    font-weight: 500;
}

.pagination-link:hover {
    background: #f3f4f6;
}

.pagination-link-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    color: #6b7280;
    font-weight: 600;
}

/* 4. THE GO TO FORM (Matched to your button styles) */
.goto-page-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.goto-label {
    margin: 0;
    font-size: 14px;
    color: #64748b;
    white-space: nowrap;
}

input.goto-input {
    padding: 5px 5px;
    border: 1px solid #d1d5db;
    border-radius: 6px; 
    text-align: center;
    color: #1f2937;
    background: #ffffff;
    box-sizing: border-box;
}

.goto-input:focus {
    outline: none;
    border-color: #2563eb;
}

.goto-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #1f2937;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    box-sizing: border-box;
    font-family: inherit;
    transition: background-color 0.2s;
}

.goto-btn:hover {
    background: #f3f4f6;
}

/* 5. MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
    .pagination-wrapper {
        justify-content: center; /* Centers everything on mobile */
    }
    
    .pagination-controls {
        justify-content: center;
    }

    .pagination-link,
    .goto-input,
    .goto-btn {
        min-width: 36px;
        height: 36px; /* Shrinks the input/button to match on mobile */
        font-size: 14px;
    }
}

/* =========================
   TIMELINE
========================= */

.timeline {
    position: relative;
    margin-top: 8px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dbe3ea;
}

.timeline-item {
    position: relative;
    padding-left: 36px;
    margin-bottom: 22px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: 2px;
    top: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2563eb;
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 1px #bfdbfe;
}

.timeline-content {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    color: #111827;
}

.timeline-header span {
    color: #6b7280;
    font-size: 13px;
}

.timeline-meta {
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    margin-bottom: 8px;
}

.timeline-text {
    color: #374151;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .timeline-item {
        padding-left: 32px;
    }

    .timeline-content {
        padding: 12px 14px;
    }

    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.timeline-item.latest .timeline-content {
    border: 2px solid #2563eb;
    background: #eff6ff;
}

.timeline-item.latest .timeline-marker {
    background: #2563eb;
    box-shadow: 0 0 0 3px #bfdbfe;
}