/* ==============================================
   Helpdesk — Praxis Tech — White Professional Theme
   ============================================== */

/* --- CSS Variables --- */
:root {
    --bg-primary: #f5f6fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fafbfc;
    --bg-input: #f8f9fa;
    --border-color: #e2e4e9;
    --border-glow: rgba(139, 26, 26, 0.25);

    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #9ba3ab;
    --text-heading: #1a1a2e;

    --accent-primary: #8B1A1A;
    --accent-primary-hover: #a52525;
    --accent-secondary: #C62828;
    --accent-gradient: linear-gradient(135deg, #8B1A1A, #C62828);

    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #2980b9;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 4px 20px rgba(139, 26, 26, 0.1);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Subtle Background Pattern --- */
.page-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(139, 26, 26, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(198, 40, 40, 0.02) 0%, transparent 50%),
        var(--bg-primary);
}

/* --- Container --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Navbar --- */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-heading);
    font-size: 1.1rem;
    font-weight: 700;
}

.nav-brand img {
    height: 40px;
    width: auto;
}

.nav-icon {
    font-size: 1.3rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--accent-primary);
}

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: var(--transition);
    min-width: 0; /* Prevent flex/grid blowout */
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-glow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: #fafbfc;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-heading);
}

.card-body {
    padding: 1.5rem;
}

/* --- Forms --- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-main);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.1);
    background: #ffffff;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group select option {
    background: #ffffff;
    color: var(--text-primary);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.65rem 1.4rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 3px 10px rgba(139, 26, 26, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(139, 26, 26, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(39, 174, 96, 0.25);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(139, 26, 26, 0.04);
}

.btn-sm {
    padding: 0.45rem 0.9rem;
    font-size: 0.84rem;
}

.btn-lg {
    padding: 0.8rem 2rem;
    font-size: 1.02rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-sm {
    padding: 0.2rem 0.55rem;
    font-size: 0.73rem;
}

.badge-new {
    background: rgba(41, 128, 185, 0.1);
    color: #2980b9;
    border: 1px solid rgba(41, 128, 185, 0.25);
}

.badge-progress {
    background: rgba(139, 26, 26, 0.08);
    color: #8B1A1A;
    border: 1px solid rgba(139, 26, 26, 0.2);
}

.badge-waiting {
    background: rgba(243, 156, 18, 0.1);
    color: #d68910;
    border: 1px solid rgba(243, 156, 18, 0.25);
}

.badge-resolved {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.25);
}

.badge-closed {
    background: rgba(99, 110, 114, 0.1);
    color: #636e72;
    border: 1px solid rgba(99, 110, 114, 0.2);
}

/* Priority Badges */
.priority-low {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border: 1px solid rgba(39, 174, 96, 0.25);
}

.priority-medium {
    background: rgba(243, 156, 18, 0.1);
    color: #d68910;
    border: 1px solid rgba(243, 156, 18, 0.25);
}

.priority-high {
    background: rgba(230, 126, 34, 0.1);
    color: #d35400;
    border: 1px solid rgba(230, 126, 34, 0.25);
}

.priority-critical {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.25);
    animation: pulse-critical 2s infinite;
}

@keyframes pulse-critical {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* --- Alerts --- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid;
}

.alert-error {
    background: rgba(231, 76, 60, 0.06);
    border-color: rgba(231, 76, 60, 0.2);
    color: #c0392b;
}

.alert-success {
    background: rgba(39, 174, 96, 0.06);
    border-color: rgba(39, 174, 96, 0.2);
    color: #27ae60;
}

.alert ul {
    margin-top: 0.5rem;
    padding-left: 1.25rem;
}

/* --- Success Page --- */
.success-container {
    text-align: center;
    padding: 3rem 0;
    max-width: 700px;
    margin: 0 auto;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce-in 0.6s ease;
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-container h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--success);
    margin-bottom: 0.5rem;
}

.success-container>p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.tracking-code-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(139, 26, 26, 0.04);
    border: 2px dashed rgba(139, 26, 26, 0.2);
    border-radius: var(--radius-lg);
}

.tracking-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.tracking-code {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: left;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.summary-value {
    color: var(--text-primary);
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* --- Ticket Detail Grid --- */
.ticket-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

.detail-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.detail-section h3 {
    font-size: 1rem;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
}

.description-text {
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 1rem;
    border-radius: var(--radius-sm);
    line-height: 1.8;
    border-left: 3px solid var(--accent-primary);
}

/* --- Timeline --- */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -26px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px var(--accent-primary);
}

.timeline-content {
    background: var(--bg-input);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.timeline-arrow {
    color: var(--text-muted);
    font-weight: 700;
}

.timeline-comment {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.timeline-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Dashboard Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.stat-card.stat-total::before {
    background: var(--accent-gradient);
}

.stat-card.stat-new::before {
    background: var(--info);
}

.stat-card.stat-progress::before {
    background: var(--accent-primary);
}

.stat-card.stat-resolved::before {
    background: var(--success);
}

.stat-card.stat-waiting::before {
    background: var(--warning);
}

.stat-card.stat-closed::before {
    background: var(--text-muted);
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    display: block;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 0.25rem;
}

/* --- Data Table --- */
.table-wrapper {
    border-radius: var(--radius-md);
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: #f8f9fa;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(139, 26, 26, 0.02);
}

.data-table .ticket-code {
    font-weight: 700;
    color: var(--accent-primary);
    white-space: nowrap;
}

.data-table .ticket-subject {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Login Page --- */
.login-container {
    max-width: 420px;
    margin: 4rem auto;
    padding: 0 20px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .login-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.login-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-heading);
}

.login-header p {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar select,
.filter-bar input {
    padding: 0.55rem 0.9rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: var(--font-main);
    transition: var(--transition);
}

.filter-bar select:focus,
.filter-bar input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: #ffffff;
}

.filter-bar select option {
    background: #ffffff;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
}

/* --- Animations --- */
.animate-in {
    animation: fade-slide-in 0.4s ease forwards;
}

@keyframes fade-slide-in {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Admin Status Update Form --- */
.update-form {
    background: rgba(139, 26, 26, 0.03);
    border: 1px solid rgba(139, 26, 26, 0.1);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.update-form h3 {
    color: var(--text-heading);
    margin-bottom: 1rem;
    font-size: 1.02rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* --- Scheduling Feature --- */
.schedule-form {
    background: rgba(41, 128, 185, 0.04);
    border: 1px solid rgba(41, 128, 185, 0.15);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.schedule-form h3 {
    color: var(--text-heading);
    margin-bottom: 1rem;
    font-size: 1.02rem;
}

.schedule-current {
    background: rgba(41, 128, 185, 0.06);
    border: 1px solid rgba(41, 128, 185, 0.15);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.schedule-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.schedule-date-display {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-heading);
}

.badge-scheduled {
    background: rgba(41, 128, 185, 0.1);
    color: #2980b9;
    border: 1px solid rgba(41, 128, 185, 0.25);
}

.badge-schedule-past {
    background: rgba(243, 156, 18, 0.1);
    color: #d68910;
    border: 1px solid rgba(243, 156, 18, 0.25);
}

.timeline-marker-schedule {
    background: #2980b9 !important;
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.2) !important;
}

.timeline-marker-cancel {
    background: #e74c3c !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2) !important;
}

/* Dashboard: Upcoming schedules */
.schedule-list {
    display: flex;
    flex-direction: column;
}

.schedule-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}

.schedule-list-item:last-child {
    border-bottom: none;
}

.schedule-list-item:hover {
    background: rgba(41, 128, 185, 0.04);
}

.schedule-list-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    padding: 6px 10px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    color: white;
}

.schedule-list-date .schedule-day {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
}

.schedule-list-date .schedule-month {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.schedule-list-details {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Schedule indicator dot in ticket table */
.schedule-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #2980b9;
    border-radius: 50%;
    margin-left: 5px;
    vertical-align: middle;
    box-shadow: 0 0 0 2px rgba(41, 128, 185, 0.25);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .nav-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .nav-links::-webkit-scrollbar {
        height: 4px;
    }
    .nav-links::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 4px;
    }

    .form-row, .settings-grid {
        grid-template-columns: 1fr !important;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .summary-grid,
    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-brand {
        font-size: 1rem;
    }

    .nav-brand img {
        height: 30px;
    }

    .tracking-code {
        font-size: 1.4rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.6rem 0.7rem;
        font-size: 0.83rem;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar select,
    .filter-bar input {
        width: 100%;
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border-color);
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    .card-body {
        padding: 1rem;
    }
}