﻿/* =========================================
   Tech Theme Styles for Computer Repair Shop
   ========================================= */

/* ---------- CSS Variables ---------- */
:root {
    --primary-blue: #2563eb;
    --primary-blue-dark: #1d4ed8;
    --secondary-blue: #3b82f6;
    --accent-orange: #f59e0b;
    --accent-green: #10b981;
    --dark-bg: #1e293b;
    --darker-bg: #0f172a;
    --light-gray: #f8fafc;
    --medium-gray: #64748b;
    --border-color: #e2e8f0;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --tech-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ---------- Global ---------- */
html {
    font-size: 14px;
    height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    min-height: 100vh;
    color: #334155;
    display: flex;
    flex-direction: column;
}

/* ---------- Navbar ---------- */
.tech-navbar {
    background: var(--tech-gradient);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    padding: .75rem 0;
    position: relative;
    z-index: 1040;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    text-decoration: none;
    color: #fff !important;
    transition: all .3s ease;
}

.brand-icon {
    background: rgba(255,255,255,.2);
    border-radius: 12px;
    padding: 8px;
    margin-right: 12px;
    transition: all .3s ease;
}

    .brand-icon i {
        font-size: 1.2rem;
        color: var(--accent-orange);
    }

.brand-name {
    color: #fff;
    font-weight: 700;
}

.brand-suffix {
    color: var(--accent-orange);
    font-weight: 300;
}

/* ---------- Nav Links ---------- */
.navbar-nav .nav-link {
    color: rgba(255,255,255,.9) !important;
    font-weight: 500;
    padding: .5rem 1rem !important;
    border-radius: 8px;
    margin: 0 2px;
    transition: all .3s ease;
    position: relative;
}

    .navbar-nav .nav-link.active {
        background: rgba(255,255,255,.2);
        color: #fff !important;
    }

.nav-link .menu-text {
    display: inline;
    transition: opacity .3s ease;
}

.nav-link i {
    transition: margin .3s ease;
}

/* Tablet widths: slightly tighter nav */
@media (max-width: 1200px) {
    .navbar-nav .nav-link {
        padding: .5rem .75rem !important;
        font-size: .9rem;
    }

    .brand-text {
        font-size: .9rem;
    }
}

/* IMPORTANT: Phones/tablets — KEEP menu text visible */
@media (max-width: 991.98px) {
    /* We explicitly DO NOT hide .menu-text on mobile */
    .navbar-collapse.show .nav-link {
        padding: .75rem 1rem !important;
    }

        .navbar-collapse.show .nav-link i {
            margin-right: .5rem !important;
        }

    .navbar-nav .nav-link {
        padding: .5rem .6rem !important;
        margin: 0 1px;
    }

    /* Collapse container + dropdowns layering and flow */
    .navbar-collapse {
        position: relative;
        z-index: 1050;
    }

    .navbar-nav .dropdown-menu {
        position: static !important;
        transform: none !important;
        width: 100%;
        margin-top: 0;
        background-color: rgba(255,255,255,.98);
        border: none;
        box-shadow: inset 0 1px 3px rgba(0,0,0,.1);
        z-index: 1060 !important;
        padding: .5rem 0;
    }

    .navbar-collapse .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        position: relative;
        z-index: 1061;
        padding: .75rem 1.5rem;
        background-color: transparent;
        transition: background-color .2s ease;
    }

        .navbar-collapse .dropdown-item:active,
        .navbar-collapse .dropdown-item:focus {
            background-color: rgba(102,126,234,.1);
        }

    .navbar-collapse .nav-item {
        position: relative;
        z-index: 1040;
    }

    .navbar-collapse .dropdown.show {
        z-index: 1055;
        isolation: isolate;
    }

    .navbar-collapse .dropdown-menu.show {
        pointer-events: auto !important;
        contain: layout;
    }
}

/* Extra-small tweaks */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.2rem;
    }

    .brand-text {
        display: none;
    }
}

/* ---------- Dropdowns (Navbar) ---------- */
.navbar .dropdown {
    position: relative;
    z-index: 1050;
}

.navbar .dropdown-menu,
.tech-dropdown {
    position: absolute;
    z-index: 1050;
    background: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
    padding: .5rem 0;
    margin-top: .5rem;
    min-width: 200px;
    overflow: visible;
}

    .tech-dropdown .dropdown-item {
        padding: .75rem 1.25rem;
        color: #475569;
        font-weight: 500;
        white-space: nowrap;
        transition: all .2s ease;
    }

        .tech-dropdown .dropdown-item i {
            width: 20px;
            margin-right: 8px;
            color: var(--medium-gray);
        }

/* Coming Soon tag */
.coming-soon {
    position: relative;
    opacity: .7;
}

    .coming-soon::after {
        content: "Coming Soon";
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        background: var(--accent-orange);
        color: #fff;
        font-size: .7rem;
        padding: 2px 6px;
        border-radius: 10px;
        font-weight: 600;
    }

/* ---------- Content Dropdowns (non-navbar) ---------- */
.dropdown-menu:not(.tech-dropdown) {
    max-height: 300px;
    overflow-y: auto;
    z-index: 1055;
    position: absolute;
}

.card-header .dropdown {
    position: relative;
    z-index: 1055;
}

.card-header .dropdown-menu {
    z-index: 1060;
}

/* ---------- Cards ---------- */
.card,
.dashboard-card,
.dashboard-card-full,
.card-full {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0,0,0,.05);
    overflow: hidden;
    transition: all .3s ease;
}

.card-full,
.dashboard-card-full {
    min-height: calc(100vh - 350px);
}

.ticket-index-card {
    min-height: calc(100vh - 120px);
}

.card-header {
    background: var(--light-gray);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--primary-blue);
}

/* Fix dropdown clipping inside cards */
.card:has(.dropdown),
.card .card-body:has(form .dropdown),
.card:has(#statusFilterDropdown) {
    overflow: visible !important;
}

/* ---------- Tables ---------- */
.table {
    border-radius: 12px;
    overflow: hidden;
}

.table-dark {
    background: var(--dark-bg);
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background: rgba(37,99,235,.03);
}

/* ---------- Alerts ---------- */
.alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(34,197,94,.1);
    color: #166534;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: rgba(239,68,68,.1);
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: rgba(234,179,8,.1);
    color: #92400e;
    border-left: 4px solid var(--warning);
}

/* ---------- Toasts ---------- */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--dark-bg);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,.2);
    transform: translateX(400px);
    opacity: 0;
    transition: all .3s ease;
    z-index: 9999;
    font-weight: 500;
}

    .toast-notification.show {
        transform: translateX(0);
        opacity: 1;
    }

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    min-height: calc(100vh - 170px);
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0;
    }

    .stat-card, .dashboard-card {
        margin-bottom: 1rem;
    }
}

/* ---------- Filters / Multiselect ---------- */
.dropdown-menu .form-check {
    margin-bottom: .5rem;
}

    .dropdown-menu .form-check:last-child {
        margin-bottom: 0;
    }

.dropdown-menu .form-check-input {
    margin-top: .25rem;
}

.dropdown-menu .form-check-label {
    font-size: .875rem;
    cursor: pointer;
    padding-left: .25rem;
}

    .dropdown-menu .form-check-label:hover {
        color: var(--bs-primary);
    }

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

.dropdown-menu .btn-link {
    font-size: .75rem;
    text-decoration: none;
    color: var(--bs-primary);
}

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

.dropdown-menu hr {
    margin: .5rem 0;
}

#statusFilterDropdown,
.filter-dropdown {
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fff !important;
    color: #495057 !important;
    border: 1px solid #ced4da !important;
    border-radius: .375rem;
    padding: .375rem .75rem;
    font-size: 1rem;
    font-weight: 400;
}

    #statusFilterDropdown:hover {
        border-color: #adb5bd !important;
    }

    #statusFilterDropdown:focus {
        border-color: #86b7fe !important;
        box-shadow: 0 0 0 .25rem rgba(13,110,253,.25) !important;
    }

    #statusFilterDropdown::after {
        margin-left: auto;
    }
    /* Positioning fallbacks if needed */
    #statusFilterDropdown + .dropdown-menu {
        position: absolute !important;
        z-index: 1060 !important;
        will-change: transform;
    }

.dropdown-menu[aria-labelledby="statusFilterDropdown"] {
    position: fixed !important;
    z-index: 1060 !important;
}

/* ---------- Stat Cards ---------- */
.stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,.08);
    border: 1px solid var(--border-color);
    transition: all .3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
}

    .stat-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, var(--primary-blue), var(--secondary-blue));
        opacity: 0;
        transition: opacity .3s ease;
    }

    .stat-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 25px rgba(0,0,0,.12);
    }

        .stat-card:hover::before {
            opacity: 1;
        }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
    transition: all .3s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 16px rgba(37,99,235,.4);
}

.stat-card:nth-child(2) .stat-icon {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    box-shadow: 0 4px 12px rgba(16,185,129,.3);
}

.stat-card:nth-child(3) .stat-icon {
    background: linear-gradient(135deg, var(--warning), #d97706);
    box-shadow: 0 4px 12px rgba(234,179,8,.3);
}

.stat-card:nth-child(4) .stat-icon {
    background: linear-gradient(135deg, var(--medium-gray), #475569);
    box-shadow: 0 4px 12px rgba(100,116,139,.3);
}

.stat-icon i {
    font-size: 1.75rem;
}

.stat-number {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--dark-bg);
    margin-bottom: .25rem;
    line-height: 1;
    animation: countUp .6s ease-out;
}

.stat-label {
    font-size: .875rem;
    color: var(--medium-gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.stat-card .stat-number.text-warning {
    color: var(--warning) !important;
}

@media (max-width: 768px) {
    .stat-card {
        min-height: 120px;
        padding: 1.25rem;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        margin-bottom: .75rem;
    }

        .stat-icon i {
            font-size: 1.5rem;
        }

    .stat-number {
        font-size: 1.875rem;
    }

    .stat-label {
        font-size: .8rem;
    }
}

/* Linkable stat card variant */
.stat-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: all .3s ease;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

    .stat-card-link:hover, .stat-card-link:focus {
        text-decoration: none;
        color: inherit;
    }

    .stat-card-link .stat-card {
        cursor: pointer;
    }

    .stat-card-link:hover .stat-card {
        transform: translateY(-8px) scale(1.02);
        box-shadow: 0 12px 35px rgba(0,0,0,.15);
        border-color: var(--primary-blue);
    }

    .stat-card-link:focus .stat-card {
        transform: translateY(-8px) scale(1.02);
        box-shadow: 0 12px 35px rgba(0,0,0,.15);
        border-color: var(--primary-blue);
        outline: 2px solid var(--primary-blue);
        outline-offset: 2px;
    }

    .stat-card-link:active .stat-card {
        transform: translateY(-4px) scale(1.01);
        box-shadow: 0 8px 25px rgba(0,0,0,.12);
    }

    .stat-card-link .stat-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, var(--primary-blue), var(--secondary-blue), var(--accent-green));
        background-size: 200% 100%;
        opacity: 0;
        transition: all .3s ease;
        animation: gradientShift 3s ease infinite;
    }

    .stat-card-link:hover .stat-card::before {
        opacity: 1;
    }

    .stat-card-link:hover .stat-icon {
        transform: scale(1.15) rotate(8deg);
        box-shadow: 0 8px 20px rgba(37,99,235,.4);
    }

    .stat-card-link:hover .stat-number {
        animation: pulseNumber .6s ease;
        color: var(--primary-blue);
    }

    .stat-card-link:hover .stat-label {
        color: var(--primary-blue);
        font-weight: 600;
    }

    .stat-card-link .stat-card::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(37,99,235,.1);
        transform: translate(-50%,-50%);
        transition: width .6s, height .6s;
        pointer-events: none;
    }

    .stat-card-link:active .stat-card::after {
        width: 300px;
        height: 300px;
    }

    .stat-card-link.success:hover .stat-card {
        border-color: var(--accent-green);
    }

        .stat-card-link.success:hover .stat-card::before {
            background: linear-gradient(90deg, var(--accent-green), #059669);
        }

    .stat-card-link.success:hover .stat-number {
        color: var(--accent-green);
    }

    .stat-card-link.success:hover .stat-label {
        color: var(--accent-green);
    }

    .stat-card-link.warning:hover .stat-card {
        border-color: var(--warning);
    }

        .stat-card-link.warning:hover .stat-card::before {
            background: linear-gradient(90deg, var(--warning), #d97706);
        }

    .stat-card-link.warning:hover .stat-number {
        color: var(--warning);
    }

    .stat-card-link.warning:hover .stat-label {
        color: var(--warning);
    }

    .stat-card-link.danger:hover .stat-card {
        border-color: var(--danger);
    }

        .stat-card-link.danger:hover .stat-card::before {
            background: linear-gradient(90deg, var(--danger), #dc2626);
        }

    .stat-card-link.danger:hover .stat-number {
        color: var(--danger);
    }

    .stat-card-link.danger:hover .stat-label {
        color: var(--danger);
    }

    .stat-card-link.loading .stat-card {
        opacity: .7;
        pointer-events: none;
    }

    .stat-card-link.loading .stat-number::after {
        content: '';
        display: inline-block;
        width: 20px;
        height: 20px;
        border: 2px solid var(--primary-blue);
        border-top-color: transparent;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-left: 8px;
    }

@media (max-width: 768px) {
    .stat-card-link:hover .stat-card {
        transform: translateY(-4px) scale(1.01);
        box-shadow: 0 8px 25px rgba(0,0,0,.12);
    }

    .stat-card-link:hover .stat-icon {
        transform: scale(1.1) rotate(5deg);
    }
}

/* Motion/contrast prefs */
@media (prefers-reduced-motion: reduce) {
    .stat-card-link .stat-card,
    .stat-card-link .stat-icon,
    .stat-card-link .stat-number,
    .stat-card-link::before,
    .stat-card-link::after {
        transition: none;
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .stat-card-link:hover .stat-card {
        border: 2px solid;
    }

    .stat-card-link:focus .stat-card {
        outline: 3px solid;
    }
}

/* ---------- Timeline & Activity ---------- */
.timeline {
    position: relative;
    padding-left: 30px;
}

    .timeline::before {
        content: '';
        position: absolute;
        left: 15px;
        top: 0;
        bottom: 0;
        width: 2px;
        background: #dee2e6;
    }

.timeline-item {
    position: relative;
    margin-bottom: 30px;
}

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

.timeline-marker {
    position: absolute;
    left: -22px;
    top: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.timeline-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-left: 15px;
}

    .timeline-content:hover {
        box-shadow: 0 2px 4px rgba(0,0,0,.1);
    }

/* Activity boxes */
.activity-box {
    background: #fff;
    padding: 12px;
    border-radius: 4px;
    border-left: 4px solid #6c757d;
}

.comment-content {
    border-left-color: #007bff !important;
}

/* Normalize spacing within comment content */
.comment-content p,
.comment-content h1,
.comment-content h2,
.comment-content h3,
.comment-content h4,
.comment-content h5,
.comment-content h6 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.comment-content p:last-child,
.comment-content h1:last-child,
.comment-content h2:last-child,
.comment-content h3:last-child,
.comment-content h4:last-child,
.comment-content h5:last-child,
.comment-content h6:last-child {
    margin-bottom: 0;
}

.comment-content ul,
.comment-content ol {
    margin-top: 0;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.comment-content table {
    margin-bottom: 0.5rem;
}

.assignee-change {
    border-left-color: #17a2b8 !important;
}

.status-change {
    border-left-color: #28a745 !important;
}

.priority-change {
    border-left-color: #ffc107 !important;
}

.created {
    border-left-color: #28a745 !important;
}

.closed {
    border-left-color: #6c757d !important;
}

.reopened {
    border-left-color: #fd7e14 !important;
}

.general-log {
    border-left-color: #6c757d !important;
}

.log-content {
    font-style: italic;
    color: #495057;
}

.activity-author {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
}

/* ---------- Footer ---------- */
.tech-footer {
    background: var(--dark-bg);
    color: rgba(255,255,255,.8);
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255,255,255,.1);
    margin-top: auto;
}

    .tech-footer a {
        color: var(--accent-orange);
        text-decoration: none;
        transition: color .3s ease;
    }

        .tech-footer a:hover {
            color: #fff;
            text-decoration: underline;
        }

    .tech-footer .social-links a {
        display: inline-block;
        margin: 0 .5rem;
        color: rgba(255,255,255,.6);
        font-size: 1.2rem;
        transition: color .3s ease;
    }

        .tech-footer .social-links a:hover {
            color: var(--accent-orange);
        }

/* ---------- Accessibility & Misc ---------- */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 .2rem rgba(37,99,235,.25);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--medium-gray);
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--primary-blue);
    }

/* ---------- Keyframes ---------- */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes pulseNumber {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Desktop/tablet: pin to right edge of its toggle */
.navbar .nav-item.user-menu .dropdown-menu {
    left: auto !important;
    right: 0 !important; /* align to right edge */
    transform: none !important; /* neutralize popper offsets that push it offscreen */
    max-width: min(92vw, 320px); /* never overflow viewport */
    overflow-wrap: anywhere; /* long text won’t force overflow */
}

    /* If Bootstrap applies data-bs-popper placement, ensure end-alignment still wins */
    .navbar .nav-item.user-menu .dropdown-menu[data-bs-popper] {
        inset: auto 0 auto auto !important; /* top auto | right 0 | bottom auto | left auto */
    }

/* Mobile (your collapse rules): keep full-width list style */
@media (max-width: 991.98px) {
    .navbar .nav-item.user-menu .dropdown-menu {
        position: static !important;
        width: 100%;
        max-width: 100%;
        left: 0 !important;
        right: auto !important;
        transform: none !important;
    }
}
/* Real-Time Notification Toasts */
.toast-notification {
    background: white;
    color: #212529;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 16px;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-out;
    border-left: 4px solid #0dcaf0;
    max-width: 400px;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification.alert-danger {
    border-left-color: #dc3545;
}

.toast-notification.alert-warning {
    border-left-color: #ffc107;
}

.toast-notification.alert-info {
    border-left-color: #0dcaf0;
}

.toast-notification.alert-secondary {
    border-left-color: #6c757d;
}

.toast-notification .btn-close {
    background-size: 0.75rem;
    padding: 0.5rem;
}

.toast-notification:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.toast-notification i {
    color: #495057;
}

.toast-notification.alert-danger i {
    color: #dc3545;
}

.toast-notification.alert-warning i {
    color: #ffc107;
}

.toast-notification.alert-info i {
    color: #0dcaf0;
}
