/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.header-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    display: block;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    color: #718096;
}

/* Controls */
.controls {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.search-input, .filter-select, .date-input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
}

.search-input {
    flex: 1;
    min-width: 250px;
}

.search-input:focus, .filter-select:focus, .date-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-select, .date-input {
    min-width: 140px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
}

/* Clickable Card Styles */
.stat-card.clickable {
    cursor: pointer !important;
    position: relative;
    transition: all 0.3s ease;
    user-select: none;
}

.stat-card.clickable:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 1);
}

.card-click-hint {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card.clickable:hover .card-click-hint {
    opacity: 1;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 800px;
    max-height: 95vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
    max-height: calc(95vh - 100px);
    overflow-y: auto;
}

/* Modal Content Styles */
.modal-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.modal-item:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

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

.modal-item-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 10px;
}

.modal-item-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 1rem;
}

.modal-item-badge {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.modal-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    font-size: 0.9rem;
    color: #4a5568;
}

.modal-item-detail {
    display: flex;
    flex-direction: column;
}

.modal-item-detail strong {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 2px;
}

.modal-empty {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.modal-empty h3 {
    margin-bottom: 10px;
    color: #4a5568;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-item-details {
        grid-template-columns: 1fr;
    }
}

/* Overdue Scans Section */
.overdue-section {
    background: linear-gradient(135deg, #ff7b7b 0%, #ff6b6b 100%);
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.3);
    overflow: hidden;
}

.overdue-header {
    display: flex;
    align-items: center;
    padding: 20px 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.overdue-header:hover {
    background: rgba(255, 255, 255, 0.1);
}

.overdue-icon {
    margin-right: 15px;
}

.overdue-icon .icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.overdue-text {
    flex: 1;
    color: white;
}

.overdue-text h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.overdue-text p {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.9;
}

.overdue-toggle {
    color: white;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.overdue-toggle.expanded {
    transform: rotate(180deg);
}

.overdue-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    margin: 0 20px 20px 20px;
    border-radius: 12px;
    overflow: hidden;
}

.overdue-list {
    max-height: 400px;
    overflow-y: auto;
}

.overdue-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    align-items: center;
    transition: background-color 0.2s ease;
}

.overdue-item:last-child {
    border-bottom: none;
}

.overdue-item:hover {
    background-color: #f7fafc;
}

.overdue-priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f56565;
}

.overdue-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.overdue-details strong {
    font-weight: 600;
    color: #2d3748;
}

.overdue-details span {
    color: #4a5568;
}

.overdue-age {
    font-size: 0.85rem;
    color: #e53e3e;
    font-weight: 600;
    white-space: nowrap;
}

/* Data Section */
.data-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    font-size: 1.5rem;
    color: #2d3748;
}

.view-options {
    display: flex;
    gap: 5px;
}

.view-btn {
    padding: 8px 16px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn.active, .view-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table th {
    background: #f7fafc;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    font-size: 14px;
}

.data-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

.data-table tr:hover {
    background: #f7fafc;
}

/* Column widths */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
    width: 8%;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    width: 12%;
}

.data-table th:nth-child(3),
.data-table td:nth-child(3) {
    width: 8%;
}

.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    width: 15%;
}

.data-table th:nth-child(5),
.data-table td:nth-child(5) {
    width: 10%;
}

.data-table th:nth-child(6),
.data-table td:nth-child(6) {
    width: 12%;
}

.data-table th:nth-child(7),
.data-table td:nth-child(7) {
    width: 10%;
}

.data-table th:nth-child(8),
.data-table td:nth-child(8) {
    width: 10%;
}

.data-table th:nth-child(9),
.data-table td:nth-child(9) {
    width: 10%;
}

.data-table th:nth-child(10),
.data-table td:nth-child(10) {
    width: 5%;
}

/* Status badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #fed7d7;
    color: #c53030;
}

.status-synced {
    background: #c6f6d5;
    color: #276749;
}

.status-failed {
    background: #fbb6ce;
    color: #b83280;
}

/* Check type badges */
.check-type {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.check-in {
    background: #bee3f8;
    color: #2c5282;
}

.check-out {
    background: #fed7aa;
    color: #c05621;
}

.lost {
    background: #fed7d7;
    color: #c53030;
}

.found {
    background: #c6f6d5;
    color: #276749;
}

/* Timeline */
.timeline-container {
    max-height: 600px;
    overflow-y: auto;
}

.timeline-item {
    display: flex;
    margin-bottom: 20px;
    position: relative;
}

.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 20px;
    top: 45px;
    bottom: -20px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    font-weight: 600;
    font-size: 12px;
    color: white;
    flex-shrink: 0;
}

.timeline-content {
    flex: 1;
    background: #f7fafc;
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.timeline-title {
    font-weight: 600;
    color: #2d3748;
    font-size: 16px;
}

.timeline-time {
    color: #718096;
    font-size: 14px;
}

.timeline-details {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.5;
}

/* No data */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
}

.no-data h3 {
    margin-bottom: 10px;
    color: #4a5568;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .search-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        min-width: unset;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .overdue-section {
        margin: 10px 0;
    }

    .overdue-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .overdue-item {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
    }

    .overdue-details {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}