/* Minimal Dense Tracking View */

/* CUSTOMIZABLE SERVICE COLORS - Edit these to change shipping method colors */
:root {
    --service-ground: #8b4513;        /* Brown - Ground shipping */
    --service-express: #dc143c;       /* Red - Express/Priority */
    --service-overnight: #ff4500;     /* Orange-Red - Overnight */
    --service-international: #4169e1; /* Blue - International/Worldwide */
    --service-default: #696969;       /* Gray - Other services */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: #000;
    background: #fff;
}

.container {
    max-width: 100%;
    padding: 0;
}

/* Header */
header {
    padding: 8px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

header h1 {
    font-size: 18px;
    font-weight: 600;
}

header .subtitle {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

/* Input Section */
.input-section {
    padding: 8px 12px;
    background: #fafafa;
    border-bottom: 1px solid #ddd;
}

.input-section h2 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-row {
    display: flex;
    gap: 4px;
}

.carrier-select,
.tracking-input {
    padding: 4px 6px;
    border: 1px solid #ccc;
    font-size: 12px;
    background: #fff;
}

.carrier-select {
    width: 140px;
}

.tracking-input {
    flex: 1;
}

.btn {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    background: #000;
    color: #fff;
}

.btn:hover {
    background: #333;
}

.btn-secondary {
    background: #666;
    margin-top: 6px;
}

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

.btn-danger {
    background: #c00;
    margin-left: 4px;
}

.btn-danger:hover {
    background: #e00;
}

.btn-mini {
    padding: 2px 6px;
    font-size: 11px;
    border: none;
    background: #eee;
    cursor: pointer;
    margin-left: 4px;
}

.btn-mini:hover {
    background: #ddd;
}

/* Bulk Operations Section - Bottom */
.bulk-operations {
    padding: 8px 12px;
    background: #fafafa;
    border-top: 2px solid #ddd;
    margin-top: 20px;
}

.bulk-operations-header {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.bulk-operations-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.bulk-box {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px;
}

.bulk-box h3 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}

.bulk-box textarea {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ccc;
    font-size: 11px;
    font-family: monospace;
    resize: vertical;
    min-height: 120px;
}

.bulk-box button {
    margin-top: 6px;
}

#bulkCopyArea button {
    float: right;
}

.hidden {
    display: none;
}

/* Results Section */
.results-section {
    padding: 0;
}

.results-header {
    padding: 8px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-header h2 {
    font-size: 12px;
    font-weight: 600;
}

.results-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.results-actions .btn {
    margin-top: 0;
}

.auto-refresh-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 4px 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.auto-refresh-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.auto-refresh-label input[type="checkbox"] {
    cursor: pointer;
}

.refresh-interval-select {
    padding: 2px 4px;
    border: 1px solid #ccc;
    font-size: 11px;
    background: #fff;
    cursor: pointer;
}

.refresh-timer {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    padding: 2px 6px;
    background: #f0f0f0;
    border-radius: 2px;
    min-width: 60px;
    text-align: center;
}

.tracking-results {
    padding: 0;
}

.empty-state {
    padding: 20px;
    text-align: center;
    color: #999;
    font-size: 12px;
}

/* Dense Table View */
.track-table {
    border-bottom: 1px solid #ddd;
}

.table-header {
    padding: 6px 12px;
    background: #f9f9f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.header-left {
    flex: 1;
}

.header-right {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Client Badge */
.client-badge {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    border-radius: 2px;
    display: inline-block;
}

/* Service/Shipping Method Badges */
.service-badge {
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    border-radius: 2px;
    margin-left: 6px;
    display: inline-block;
}

.service-ground {
    background-color: var(--service-ground);
}

.service-express {
    background-color: var(--service-express);
}

.service-overnight {
    background-color: var(--service-overnight);
}

.service-international {
    background-color: var(--service-international);
}

.service-default {
    background-color: var(--service-default);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

table td {
    padding: 3px 12px;
    border-top: 1px solid #f0f0f0;
}

table td:first-child {
    width: 100px;
    color: #666;
    font-weight: 500;
}

table td:last-child {
    color: #000;
}

/* Status Colors */
.status-delivered {
    color: #0a0;
}

.status-in_transit,
.status-transit {
    color: #06c;
}

.status-unknown,
.status-pending {
    color: #999;
}

.status-failure,
.status-returned {
    color: #c00;
}

/* Events Table */
.events-header {
    padding: 6px 12px;
    background: #f5f5f5;
    font-weight: 600;
    font-size: 11px;
    border-top: 1px solid #ddd;
    cursor: pointer;
    user-select: none;
}

.events-header:hover {
    background: #eee;
}

.toggle-icon {
    display: inline-block;
    width: 12px;
    font-size: 10px;
}

.events-table {
    font-size: 11px;
}

.events-table thead {
    background: #fafafa;
}

.events-table th {
    padding: 3px 6px;
    text-align: left;
    font-weight: 600;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.events-table td {
    padding: 3px 6px;
    border-top: 1px solid #f5f5f5;
}

.events-table td:first-child {
    /* width: auto; */
    width: 100px;
    font-family: monospace;
}

.events-table td:nth-child(2) {
    text-align: left;
    font-family: monospace;
}

.problem-event {
    color: #ff0000 !important;
    font-weight: bold !important;
}

.customs-event {
    color: #0000ff !important;
    font-weight: bold !important;
}

/* Layout - side by side */
.track-content {
    display: flex;
    gap: 0;
}

.track-info {
    flex: 1;
    min-width: 0;
}

/* Map - right side */
.map-container-side {
    width: 375px;
    flex-shrink: 0;
    border-left: 1px solid #ddd;
}

.map {
    height: 100%;
    width: 100%;
    min-height: 125px;
}

/* Loading & Error States */
.loading {
    padding: 12px;
    text-align: center;
    color: #666;
    font-size: 12px;
}

.error {
    padding: 12px;
    background: #fee;
    color: #c00;
    font-size: 12px;
}

/* Footer */
footer {
    padding: 8px 12px;
    text-align: center;
    font-size: 10px;
    color: #999;
    border-top: 1px solid #ddd;
    margin-top: 20px;
}

/* Remove ALL unnecessary spacing */
.tracking-results > * {
    margin: 0;
}

/* Compact everything */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    padding: 0;
}

p {
    margin: 0;
    padding: 0;
}

/* Info bubble for mobile details */
.detail-info-icon {
    cursor: pointer;
    font-size: 16px;
    display: inline-block;
}

.detail-bubble {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 16px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.detail-bubble.active {
    display: block;
}

.detail-bubble-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.detail-bubble-overlay.active {
    display: block;
}

.detail-bubble-close {
    float: right;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    margin: -8px -8px 8px 8px;
}

.detail-bubble-content {
    clear: both;
    font-size: 13px;
    line-height: 1.6;
}

.detail-full-text {
    display: inline;
}

/* Mobile responsive - hide maps on phones */
@media only screen and (max-width: 768px) {
    .map-container-side {
        display: none;
    }
    
    .map {
        display: none;
    }
    
    /* Show info icon, hide full text on mobile */
    .detail-full-text {
        display: none;
    }
    
    .detail-info-icon {
        display: inline-block;
    }
}

/* Desktop - show full text, hide info icon */
@media only screen and (min-width: 769px) {
    .detail-info-icon {
        display: none;
    }
    
    .detail-full-text {
        display: inline;
    }
}
