/* Developer Helpdesk - Public Styles */

/* CSS Variables are injected via branding inline styles */
:root {
    --dvh-primary: #2563eb;
    --dvh-secondary: #1e40af;
    --dvh-accent: #3b82f6;
    --dvh-success: #16a34a;
    --dvh-warning: #d97706;
    --dvh-danger: #dc2626;
    --dvh-text: #1e293b;
    --dvh-bg: #f8fafc;
    --dvh-card-bg: #ffffff;
    --dvh-border: #e2e8f0;
    --dvh-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --dvh-header-bg: #1e293b;
    --dvh-header-text: #ffffff;
    --dvh-radius: 8px;
    --dvh-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --dvh-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

/* Reset for helpdesk container */
.dvh-app *, .dvh-auth-wrapper * { box-sizing: border-box; }

.dvh-app {
    font-family: var(--dvh-font);
    color: var(--dvh-text);
    background: var(--dvh-bg);
    min-height: 100vh;
    line-height: 1.6;
}

/* Header */
.dvh-header {
    background: var(--dvh-header-bg);
    color: var(--dvh-header-text);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--dvh-shadow);
}
.dvh-header-left { display: flex; align-items: center; gap: 12px; }
.dvh-header-logo { height: 36px; width: auto; }
.dvh-header-title { font-size: 18px; font-weight: 600; margin: 0; }
.dvh-header-right { display: flex; align-items: center; gap: 16px; }

.dvh-notifications-toggle {
    position: relative;
    cursor: pointer;
    padding: 6px;
}
.dvh-notifications-toggle .dashicons { font-size: 20px; color: var(--dvh-header-text); }
.dvh-notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--dvh-danger);
    color: #fff;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.dvh-user-menu { position: relative; cursor: pointer; }
.dvh-user-name { font-size: 14px; font-weight: 500; }
.dvh-user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--dvh-card-bg);
    border: 1px solid var(--dvh-border);
    border-radius: var(--dvh-radius);
    box-shadow: var(--dvh-shadow-lg);
    min-width: 180px;
    z-index: 200;
    margin-top: 8px;
}
.dvh-user-menu:hover .dvh-user-dropdown,
.dvh-user-dropdown.active { display: block; }
.dvh-user-dropdown a {
    display: block;
    padding: 10px 16px;
    color: var(--dvh-text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}
.dvh-user-dropdown a:hover { background: var(--dvh-bg); }

/* Navigation */
.dvh-nav {
    background: var(--dvh-card-bg);
    border-bottom: 1px solid var(--dvh-border);
    padding: 0 24px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
}
.dvh-nav-item {
    padding: 12px 16px;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
}
.dvh-nav-item:hover { color: var(--dvh-primary); }
.dvh-nav-item.active {
    color: var(--dvh-primary);
    border-bottom-color: var(--dvh-primary);
}
.dvh-nav-item .dashicons { font-size: 16px; width: 16px; height: 16px; }

/* Main content */
.dvh-main { padding: 24px; max-width: 1200px; margin: 0 auto; }

/* Stats Grid */
.dvh-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.dvh-stat-card {
    background: var(--dvh-card-bg);
    border: 1px solid var(--dvh-border);
    border-radius: var(--dvh-radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--dvh-shadow);
}
.dvh-stat-number { font-size: 32px; font-weight: 700; line-height: 1.2; }
.dvh-stat-label { font-size: 13px; color: #64748b; margin-top: 4px; }
.dvh-stat-open .dvh-stat-number { color: var(--dvh-primary); }
.dvh-stat-assigned .dvh-stat-number { color: var(--dvh-warning); }
.dvh-stat-overdue .dvh-stat-number { color: var(--dvh-danger); }
.dvh-stat-resolved .dvh-stat-number { color: var(--dvh-success); }

/* Cards */
.dvh-content-card {
    background: var(--dvh-card-bg);
    border: 1px solid var(--dvh-border);
    border-radius: var(--dvh-radius);
    box-shadow: var(--dvh-shadow);
    padding: 24px;
}
.dvh-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.dvh-card-header h2 { margin: 0; font-size: 20px; }
.dvh-section { margin-top: 24px; }
.dvh-section h3 { font-size: 16px; margin-bottom: 12px; }

/* Forms */
.dvh-form { max-width: 640px; }
.dvh-form.dvh-form-wide { max-width: none; }
.dvh-field { margin-bottom: 16px; }
.dvh-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--dvh-text);
}
.dvh-field input[type="text"],
.dvh-field input[type="email"],
.dvh-field input[type="url"],
.dvh-field input[type="number"],
.dvh-field input[type="password"],
.dvh-field input[type="date"],
.dvh-field select,
.dvh-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--dvh-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--dvh-font);
    background: var(--dvh-card-bg);
    color: var(--dvh-text);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.dvh-field input:focus, .dvh-field select:focus, .dvh-field textarea:focus {
    outline: none;
    border-color: var(--dvh-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.dvh-field small, .dvh-help-text { font-size: 12px; color: #64748b; margin-top: 4px; display: block; }
.dvh-required { color: var(--dvh-danger); }
.dvh-field-row { display: flex; gap: 16px; }
.dvh-field-half { flex: 1; }
.dvh-form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* Buttons */
.dvh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: var(--dvh-font);
    line-height: 1.4;
}
.dvh-btn-primary { background: var(--dvh-primary); color: #fff; }
.dvh-btn-primary:hover { background: var(--dvh-secondary); color: #fff; }
.dvh-btn-secondary { background: #f1f5f9; color: var(--dvh-text); border: 1px solid var(--dvh-border); }
.dvh-btn-secondary:hover { background: #e2e8f0; color: var(--dvh-text); }
.dvh-btn-danger { background: var(--dvh-danger); color: #fff; }
.dvh-btn-danger:hover { background: #b91c1c; color: #fff; }
.dvh-btn-block { width: 100%; }
.dvh-btn-sm { padding: 6px 12px; font-size: 12px; }
.dvh-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Auth wrapper */
.dvh-auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 40px 20px;
    background: var(--dvh-bg);
}
.dvh-auth-card {
    background: var(--dvh-card-bg);
    border: 1px solid var(--dvh-border);
    border-radius: var(--dvh-radius);
    box-shadow: var(--dvh-shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}
.dvh-auth-card h2 { text-align: center; margin: 0 0 20px; font-size: 22px; }
.dvh-auth-logo { text-align: center; margin-bottom: 20px; }
.dvh-auth-logo img { max-height: 50px; }
.dvh-auth-subtitle { text-align: center; color: #64748b; font-size: 14px; margin: -8px 0 20px; }
.dvh-auth-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}
.dvh-auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--dvh-border);
}
.dvh-auth-divider span {
    background: var(--dvh-card-bg);
    padding: 0 12px;
    position: relative;
    color: #94a3b8;
    font-size: 13px;
}
.dvh-auth-links {
    text-align: center;
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 16px;
}
.dvh-auth-links a { font-size: 13px; color: var(--dvh-primary); text-decoration: none; }
.dvh-auth-links a:hover { text-decoration: underline; }

/* MFA input */
.dvh-mfa-input {
    text-align: center;
    font-size: 28px !important;
    letter-spacing: 8px;
    font-weight: 600;
    font-family: monospace;
}

/* Tables */
.dvh-table-wrapper { overflow-x: auto; }
.dvh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.dvh-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--dvh-border);
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.dvh-table td {
    padding: 12px;
    border-bottom: 1px solid var(--dvh-border);
    vertical-align: middle;
}
.dvh-table tr:hover { background: #f8fafc; }
.dvh-table .dvh-ticket-link {
    color: var(--dvh-primary);
    text-decoration: none;
    font-weight: 500;
}
.dvh-table .dvh-ticket-link:hover { text-decoration: underline; }
.dvh-sortable { cursor: pointer; user-select: none; }
.dvh-sortable:hover { color: var(--dvh-primary); }

/* Badges */
.dvh-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}
.dvh-badge-default { background: #f1f5f9; color: #475569; }
.dvh-badge-info { background: #dbeafe; color: #1e40af; }

/* Status badges */
.dvh-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}
.dvh-status-open { background: #dbeafe; color: #1d4ed8; }
.dvh-status-assigned { background: #e0e7ff; color: #4338ca; }
.dvh-status-in_progress, .dvh-status-in-progress { background: #fef3c7; color: #92400e; }
.dvh-status-pending { background: #fed7aa; color: #9a3412; }
.dvh-status-resolved { background: #d1fae5; color: #065f46; }
.dvh-status-closed { background: #f1f5f9; color: #475569; }

/* Priority badges */
.dvh-priority-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}
.dvh-priority-low { background: #f0fdf4; color: #166534; }
.dvh-priority-medium { background: #fefce8; color: #854d0e; }
.dvh-priority-high { background: #fff7ed; color: #c2410c; }
.dvh-priority-critical { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Notices */
.dvh-notice {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dvh-notice-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.dvh-notice-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.dvh-notice-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.dvh-notice-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Filters */
.dvh-filters { margin-bottom: 16px; }
.dvh-filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.dvh-filter-input, .dvh-filter-select {
    padding: 8px 12px;
    border: 1px solid var(--dvh-border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--dvh-card-bg);
}
.dvh-filter-input { flex: 1; min-width: 200px; }
.dvh-filter-checkbox { display: flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }

/* Pagination */
.dvh-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
}
.dvh-pagination a, .dvh-pagination span {
    padding: 6px 12px;
    border: 1px solid var(--dvh-border);
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    color: var(--dvh-text);
}
.dvh-pagination .current { background: var(--dvh-primary); color: #fff; border-color: var(--dvh-primary); }
.dvh-pagination a:hover { background: #f1f5f9; }

/* Notifications panel */
.dvh-notifications-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 360px;
    max-height: 500px;
    background: var(--dvh-card-bg);
    border: 1px solid var(--dvh-border);
    border-radius: var(--dvh-radius);
    box-shadow: var(--dvh-shadow-lg);
    z-index: 300;
    overflow: hidden;
}
.dvh-notif-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--dvh-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dvh-notif-header h3 { margin: 0; font-size: 15px; }
.dvh-notif-header a { font-size: 12px; color: var(--dvh-primary); text-decoration: none; }
.dvh-notif-list { max-height: 420px; overflow-y: auto; }
.dvh-notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--dvh-border);
    cursor: pointer;
    transition: background 0.15s;
}
.dvh-notif-item:hover { background: #f8fafc; }
.dvh-notif-item.unread { background: #eff6ff; }
.dvh-notif-item .dvh-notif-subject { font-weight: 500; font-size: 13px; }
.dvh-notif-item .dvh-notif-time { font-size: 11px; color: #94a3b8; margin-top: 4px; }

/* Profile section */
.dvh-profile-section { margin-bottom: 32px; }
.dvh-profile-section h3 { font-size: 16px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--dvh-border); }
.dvh-info-grid { display: grid; gap: 8px; }
.dvh-info-row { display: flex; gap: 12px; padding: 8px 0; }
.dvh-info-label { font-weight: 500; min-width: 140px; color: #64748b; font-size: 14px; }
.dvh-info-value { font-size: 14px; }
.dvh-mfa-actions { display: flex; gap: 12px; margin: 16px 0; }
.dvh-backup-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: monospace; font-size: 14px; }
.dvh-backup-codes code { padding: 6px 10px; background: #f1f5f9; border-radius: 4px; text-align: center; }

/* Report output */
.dvh-report-filters { margin-bottom: 24px; }
.dvh-report-output { min-height: 200px; }
.dvh-text-muted { color: #94a3b8; }

/* Loading */
.dvh-loading {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 14px;
}

/* Footer */
.dvh-footer {
    text-align: center;
    padding: 16px;
    color: #94a3b8;
    font-size: 12px;
    border-top: 1px solid var(--dvh-border);
    margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
    .dvh-header { padding: 10px 16px; }
    .dvh-main { padding: 16px; }
    .dvh-nav { padding: 0 16px; }
    .dvh-field-row { flex-direction: column; gap: 0; }
    .dvh-auth-card { padding: 24px; }
    .dvh-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dvh-filter-row { flex-direction: column; }
    .dvh-filter-input { min-width: auto; width: 100%; }
    .dvh-notifications-panel { width: calc(100% - 40px); right: 20px; }
}
