/* =============================================
   JDX Field PWA - Admin Template Styles
   ============================================= */

:root {
    --primary-color: #1a73e8;
    --primary-dark: #1557b0;
    --sidebar-width: 250px;
    --navbar-height: 56px;
    --bg-light: #f8f9fa;
    --bg-dark: #343a40;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
}

/* Base styles */
body {
    background-color: var(--bg-light);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.has-sidebar {
    padding-top: var(--navbar-height);
}

/* =============================================
   Top Navbar
   ============================================= */
.navbar.fixed-top {
    height: var(--navbar-height);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

/* =============================================
   Sidebar
   ============================================= */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background-color: #fff;
    border-right: 1px solid var(--border-color);
    z-index: 1020;
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(26, 115, 232, 0.08);
    color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
    background-color: rgba(26, 115, 232, 0.12);
    color: var(--primary-color);
}

/* =============================================
   Main Content
   ============================================= */
.main-content {
    min-height: calc(100vh - var(--navbar-height));
}

.content-wrapper {
    padding: 1.5rem;
}

/* Desktop: content beside sidebar */
@media (min-width: 992px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
}

/* Mobile: full width content */
@media (max-width: 991.98px) {
    .content-wrapper {
        padding: 1rem;
    }
}

/* =============================================
   Flash Messages
   ============================================= */
.flash-container {
    padding: 0 1.5rem;
    padding-top: 1rem;
}

@media (max-width: 991.98px) {
    .flash-container {
        padding: 1rem;
    }
}

/* =============================================
   Auth Layout (Login Page)
   ============================================= */
.auth-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 2rem;
    text-align: center;
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    opacity: 0.9;
    margin-bottom: 0;
}

.login-body {
    padding: 2rem;
}

.login-body .form-control {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
}

.login-body .btn-primary {
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
}

.login-body .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #0d47a1 100%);
}

/* =============================================
   Cards - Job List & Detail
   ============================================= */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

/* Job card specific styles */
.job-card {
    cursor: pointer;
    margin-bottom: 1rem;
}

.job-card .card-body {
    padding: 1rem;
}

.job-card .job-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.job-card .job-customer {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.job-card .job-time {
    font-size: 0.85rem;
    color: var(--primary-color);
}

/* Stage badges */
.badge-stage {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    font-weight: 500;
}

/* =============================================
   Page Headers
   ============================================= */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.page-header .breadcrumb {
    margin-bottom: 0;
    font-size: 0.875rem;
}

/* =============================================
   Signature Canvas
   ============================================= */
.signature-canvas {
    width: 100%;
    height: 200px;
    border: 1px solid var(--border-color);
    border-radius: 0 0 0.5rem 0.5rem;
    touch-action: none;
    background-color: #fff;
}

.signature-pad-wrapper {
    background: #f1f3f4;
    border-radius: 0.5rem;
    overflow: hidden;
}

.signature-pad-header {
    background: #fff;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =============================================
   Offline Banner
   ============================================= */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #dc3545;
    color: white;
    text-align: center;
    padding: 8px 16px;
    font-size: 14px;
    z-index: 1100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.has-sidebar .offline-banner {
    top: var(--navbar-height);
}

/* =============================================
   Form Draft Banner
   ============================================= */
.draft-restored-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #198754;
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1050;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.draft-restored-banner button {
    background: none;
    border: 1px solid white;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 8px;
}

.draft-restored-banner button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* =============================================
   Offline Page
   ============================================= */
.offline-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.offline-page .offline-icon {
    font-size: 64px;
    margin-bottom: 24px;
    color: var(--text-muted);
}

.offline-page h1 {
    color: #343a40;
    margin-bottom: 16px;
}

.offline-page p {
    color: var(--text-muted);
    max-width: 300px;
}

/* =============================================
   Buttons
   ============================================= */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* =============================================
   Utilities
   ============================================= */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Action buttons row */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-buttons .btn {
    flex: 1;
    min-width: 120px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Stats cards */
.stats-card {
    text-align: center;
    padding: 1.5rem;
}

.stats-card .stats-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stats-card .stats-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* =============================================
   Inventory List Items
   ============================================= */
.picking-item {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.list-group-item-action:hover {
    background-color: #e9ecef !important;
}

.list-group-item-action:active {
    background-color: #dee2e6 !important;
}

/* =============================================
   Loading Overlay
   ============================================= */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    text-align: center;
}

.loading-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
}

.loading-text {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.95rem;
}

/* =============================================
   Activity Log HTML Content
   ============================================= */
.log-body {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.log-body p {
    margin-bottom: 0.5rem;
}

.log-body p:last-child {
    margin-bottom: 0;
}

.log-body a {
    color: var(--primary-color);
    text-decoration: underline;
}

.log-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.log-body ul, .log-body ol {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.log-body blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: var(--text-muted);
}

.log-body table {
    width: 100%;
    margin: 0.5rem 0;
    border-collapse: collapse;
}

.log-body table th,
.log-body table td {
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}
