/* SAPS Pawn - Custom Styles */

/* Root Variables */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --police-color: #0a58ca;
}

/* General Styles */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f8f9fa;
}

/* Navbar Customization */
.navbar-brand {
    font-weight: 700;
}

.navbar-brand .navbar-logo {
    height: 28px !important;
    max-height: 28px !important;
    width: auto !important;
    max-width: 28px;
    object-fit: contain;
}

/* Prevent navbar from growing beyond expected height */
.navbar > .container-fluid {
    min-height: 0;
}

.navbar img {
    max-height: 36px;
}

/* Navbar Dropdown Improvements */
.navbar .dropdown-menu {
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    min-width: 220px;
}

.navbar .dropdown-menu-lg {
    min-width: 280px;
}

.navbar .dropdown-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    padding: 0.5rem 1rem 0.25rem;
    margin-top: 0.25rem;
}

.navbar .dropdown-header:first-child {
    margin-top: 0;
}

.navbar .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #495057;
    transition: all 0.15s ease;
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
    background: linear-gradient(180deg, #2d6595 0%, #16365a 45%, #1e4d7a 100%);
    color: #fff;
}

.navbar .dropdown-item i {
    color: #6c757d;
    width: 1.25rem;
    text-align: center;
}

.navbar .dropdown-item:hover i,
.navbar .dropdown-item:focus i {
    color: #fff;
}

.navbar .dropdown-divider {
    margin: 0.35rem 0;
}

/* Username truncation in navbar */
.navbar-username {
    max-width: 140px;
    display: inline-block;
    vertical-align: middle;
}

/* Responsive navbar: icons-only on LG screens */
@media (min-width: 992px) and (max-width: 1199px) {
    .navbar .nav-link {
        padding-left: 0.35rem;
        padding-right: 0.35rem;
        font-size: 0.85rem;
    }
    .navbar .nav-link i {
        margin-right: 0 !important;
    }
}

/* Responsive navbar: tighter spacing on XL screens (text + icons) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .navbar .nav-link {
        padding-left: 0.4rem;
        padding-right: 0.4rem;
        font-size: 0.875rem;
    }
    .navbar-username {
        max-width: 110px;
    }
}

/* Icon-only on smaller screens within lg breakpoint */
@media (max-width: 991px) {
    .navbar .dropdown-menu {
        background-color: rgba(255, 255, 255, 0.98);
    }
}

/* Card Improvements */
.card {
    border-radius: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

/* Dashboard Stats Cards */
.stat-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 1.5rem;
}

/* Status Badges */
.badge-in-pawn {
    background-color: #ffc107;
    color: #212529;
}

.badge-redeemed {
    background-color: #198754;
    color: #fff;
}

.badge-sold {
    background-color: #0d6efd;
    color: #fff;
}

.badge-forfeited {
    background-color: #dc3545;
    color: #fff;
}

.badge-locked {
    background-color: #dc3545;
    color: #fff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Item Cards */
.item-card {
    transition: all 0.2s ease;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.item-card .item-image {
    height: 200px;
    object-fit: cover;
    background-color: #e9ecef;
}

.item-card.locked {
    border: 2px solid #dc3545;
    position: relative;
}

.item-card.locked::before {
    content: 'LOCKED';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 1;
}

/* Table Improvements */
.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

.table th {
    font-weight: 600;
    color: #495057;
    border-top: none;
}

/* Form Improvements */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Sidebar for Dashboard */
.sidebar {
    min-height: calc(100vh - 56px);
    background-color: #fff;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.sidebar .nav-link {
    color: #495057;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 0.125rem 0;
}

.sidebar .nav-link:hover {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
}

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar .nav-link i {
    width: 1.5rem;
}

/* Police Portal Specific */
.police-banner {
    background: linear-gradient(135deg, #0a58ca 0%, #084298 100%);
    color: white;
}

.locked-item-alert {
    border-left: 4px solid #dc3545;
    background-color: #fff5f5;
}

/* Barcode Display */
.barcode-container {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

.barcode-container img {
    max-width: 100%;
    height: auto;
}

/* Quick Actions Buttons */
.quick-actions .btn {
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.quick-actions .btn i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Custom button colors for dashboard quick actions */
.btn-vehicle-pawn {
    background-color: #fd7e14 !important;
    border-color: #fd7e14 !important;
    color: #fff !important;
}

.btn-vehicle-pawn:hover,
.btn-vehicle-pawn:focus {
    background-color: #e8690b !important;
    border-color: #e8690b !important;
    color: #fff !important;
}

.btn-vehicle-pawn.disabled,
.btn-vehicle-pawn:disabled {
    background-color: #fd7e14 !important;
    border-color: #fd7e14 !important;
    color: #fff !important;
    opacity: 0.65;
}

.btn-buy-direct {
    background-color: #6f42c1 !important;
    border-color: #6f42c1 !important;
    color: #fff !important;
}

.btn-buy-direct:hover,
.btn-buy-direct:focus {
    background-color: #5a32a3 !important;
    border-color: #5a32a3 !important;
    color: #fff !important;
}

.btn-buy-direct.disabled,
.btn-buy-direct:disabled {
    background-color: #6f42c1 !important;
    border-color: #6f42c1 !important;
    color: #fff !important;
    opacity: 0.65;
}

/* Search Results */
.search-result-item {
    border-left: 3px solid transparent;
    transition: border-color 0.2s;
}

.search-result-item:hover {
    border-left-color: var(--primary-color);
}

/* Print Styles */
@media print {
    .no-print,
    .navbar,
    .sidebar,
    .btn {
        display: none !important;
    }

    .card {
        border: none;
        box-shadow: none;
    }

    body {
        background: white;
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .stat-card .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

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

/* Currency Display */
.currency {
    font-family: 'Consolas', monospace;
}

.currency::before {
    content: 'R';
}

/* Subscription Status */
.subscription-active {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    color: white;
}

.subscription-expiring {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

.subscription-expired {
    background: linear-gradient(135deg, #dc3545 0%, #bb2d3b 100%);
    color: white;
}

/* Sync Status Indicator */
#sync-status-widget {
    transition: all 0.3s ease;
}

#sync-status-widget .sync-indicator {
    font-size: 1.1rem;
    line-height: 1;
}

#sync-status-widget a {
    padding: 0.4rem 0.6rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
}

#sync-status-widget a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Sync spinning animation */
.sync-spinning {
    animation: sync-spin 1s linear infinite;
}

@keyframes sync-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Sync status update flash */
.sync-status-updated {
    animation: sync-flash 0.5s ease;
}

@keyframes sync-flash {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }

}

/* ==========================================
   METALLIC HEADER & FOOTER
   ========================================== */

/* Metallic Navbar (Steel Blue) */
.navbar.bg-primary {
    background: linear-gradient(180deg, #2d6595 0%, #16365a 45%, #1e4d7a 100%) !important;
}

/* Metallic Footer (matching navbar Steel Blue) */
footer.bg-dark {
    background: linear-gradient(180deg, #1e4d7a 0%, #16365a 45%, #2d6595 100%) !important;
}

/* Sync status colors */
#sync-status-widget .text-success { color: #20c997 !important; }
#sync-status-widget .text-warning { color: #ffc107 !important; }
#sync-status-widget .text-danger { color: #ff6b6b !important; }
#sync-status-widget .text-secondary { color: #adb5bd !important; }
#sync-status-widget .text-info { color: #17a2b8 !important; }

/* Pulse animation for offline status */
#sync-status-widget .text-danger {
    animation: sync-pulse 2s ease-in-out infinite;
}

@keyframes sync-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
