/* ===== Drill Page Specific Styles ===== */

/* Google Maps InfoWindow Custom Styling - Remove white background */
.gm-style .gm-style-iw-c {
    padding: 0 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    background: transparent !important;
}

.gm-style .gm-style-iw-d {
    overflow: hidden !important;
    max-height: none !important;
}

.gm-style .gm-style-iw-t::after {
    background: #1e293b !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

/* Hide the white arrow/pointer */
.gm-style .gm-style-iw-tc::after {
    background: #1e293b !important;
}

/* Close button styling - Make it visible and red */
.gm-ui-hover-effect {
    top: 8px !important;
    right: 8px !important;
    width: 28px !important;
    height: 28px !important;
    opacity: 1 !important;
    background: rgba(239, 68, 68, 0.9) !important; /* Red background */
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.gm-ui-hover-effect:hover {
    opacity: 1 !important;
    background: rgba(220, 38, 38, 1) !important; /* Darker red on hover */
    transform: scale(1.1) !important;
}

/* Make the X icon visible */
.gm-ui-hover-effect > span {
    background-color: white !important;
    width: 14px !important;
    height: 14px !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center / contain !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E") center / contain !important;
}

/* Close button container positioning */
.gm-style-iw-chr {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
}

/* Drill Control Panel */
.drill-control-panel {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 18px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.drill-timer-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.timer-display {
    text-align: left;
    flex-shrink: 0;
}

.timer-label {
    font-size: 11px;
    opacity: 0.9;
    margin-bottom: 3px;
}

.timer-value {
    font-size: 32px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.drill-status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.drill-status-badge.active {
    background: rgba(34, 197, 94, 0.3);
    border-color: #22c55e;
    animation: pulse 2s infinite;
}

.drill-status-badge.stopped {
    background: rgba(251, 146, 60, 0.3);
    border-color: #fb923c;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
}

.status-indicator {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
}

.drill-status-badge.active .status-indicator {
    background: #22c55e;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.status-text {
    font-weight: 600;
    font-size: 13px;
}

.drill-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}

.btn-lg {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* Split View Layout */
.split-view-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
    height: calc(100vh - 420px);
    min-height: 600px;
}

.table-side {
    display: flex;
    flex-direction: column;
    background: #1e293b;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.map-side {
    display: flex;
    flex-direction: column;
    background: #1e293b;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.map-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.map-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.drill-map {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 500px;
}

/* Drill Statistics Section */
.drill-stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: #1e293b;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 3px solid #6b7280;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.stat-card.stat-total {
    border-left-color: #3b82f6;
}

.stat-card.stat-mustered {
    border-left-color: #22c55e;
}

.stat-card.stat-missing {
    border-left-color: #ef4444;
}

.stat-card.stat-response {
    border-left-color: #f59e0b;
}

.stat-card.stat-moving {
    border-left-color: #3b82f6;
}

.stat-card.stat-standby {
    border-left-color: #a855f7;
}

.stat-icon {
    font-size: 24px;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #f1f5f9;
}

/* Table Container */
.table-side .table-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 0;
}

.table-side .table-header h2 {
    color: white;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.table-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    font-size: 13px;
    width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: white;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.filter-select {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: white;
    background: white;
}

/* Drill Table */
.table-side table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table-side {
    overflow-y: auto;
}

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

.drill-table thead {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: white;
}

.drill-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.drill-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s;
}

.drill-table tbody tr:hover {
    background: #f9fafb;
}

.drill-table td {
    padding: 15px;
    color: #374151;
}

.row-mustered {
    background: rgba(34, 197, 94, 0.05);
}

.row-not-mustered {
    background: rgba(239, 68, 68, 0.05);
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-mustered {
    background: #d1fae5;
    color: #065f46;
}

.status-not-mustered {
    background: #fee2e2;
    color: #991b1b;
}

.battery-indicator {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.battery-good {
    background: #d1fae5;
    color: #065f46;
}

.battery-medium {
    background: #fef3c7;
    color: #92400e;
}

.battery-low {
    background: #fee2e2;
    color: #991b1b;
}

/* Mode Badge Styles */
.mode-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.mode-moving {
    background: #dbeafe;
    color: #1e40af;
}

.mode-standby {
    background: #f3e8ff;
    color: #6b21a8;
}

.mode-unknown {
    background: #f1f5f9;
    color: #64748b;
}

.loading-row td,
.empty-row td,
.error-row td {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.error-row td {
    color: #dc2626;
}

/* Button Variants */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

/* View toggle styles removed - now using split view layout */

#map {
    height: 600px;
    width: 100%;
}

/* Sortable Columns */
.sortable {
    user-select: none;
    position: relative;
}

.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sort-icon {
    margin-left: 5px;
    font-size: 10px;
    opacity: 0.6;
}

.sortable.sorted .sort-icon {
    opacity: 1;
    color: #3b82f6;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .drill-timer-section {
        flex-wrap: wrap;
    }

    .drill-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .split-view-container {
        height: calc(100vh - 450px);
    }
}

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

    .header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header-logo {
        width: 70px;
        margin-bottom: 10px;
    }

    .header-content h1 {
        font-size: 1.2em;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .header-actions .btn {
        width: 100%;
        padding: 10px;
        font-size: 14px;
    }

    .drill-control-panel {
        padding: 15px;
    }

    .drill-timer-section {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .timer-display {
        text-align: center;
    }

    .timer-value {
        font-size: 28px;
    }

    .drill-status-badge {
        align-self: center;
        justify-content: center;
    }

    .drill-actions {
        flex-direction: column;
        width: 100%;
        margin-left: 0;
        gap: 10px;
    }

    .btn-lg {
        width: 100%;
        padding: 12px;
        font-size: 14px;
        min-height: 44px;
    }

    .drill-stats-section {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .muster-point-stats-section {
        padding: 15px;
    }

    .muster-stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .muster-stat-card {
        padding: 15px;
    }

    .muster-stat-value {
        font-size: 24px;
    }

    .table-header {
        padding: 12px 15px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .table-header h2 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .table-controls {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .table-controls .btn {
        width: 100%;
        min-height: 44px;
    }

    .search-input,
    .filter-select {
        width: 100%;
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }

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

    .drill-table th,
    .drill-table td {
        padding: 10px 8px;
        font-size: 11px;
    }

    .split-view-container {
        grid-template-columns: 1fr;
        height: auto;
        gap: 15px;
    }

    .map-side {
        order: -1;
        min-height: 400px;
        max-height: 50vh;
    }

    .table-side {
        min-height: 400px;
        max-height: 50vh;
    }

    .map-header {
        padding: 12px 15px;
    }

    .map-header h2 {
        font-size: 16px;
    }

    .drill-map {
        min-height: 400px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 12px;
    }

    .header-content h1 {
        font-size: 1em;
    }

    .drill-control-panel {
        padding: 12px;
    }

    .timer-value {
        font-size: 24px;
    }

    .drill-stats-section {
        gap: 8px;
    }

    .stat-card {
        padding: 10px;
    }

    .stat-value {
        font-size: 18px;
    }

    .muster-stat-value {
        font-size: 20px;
    }

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

    .drill-table th,
    .drill-table td {
        padding: 8px 6px;
        font-size: 10px;
    }

    .map-side,
    .table-side {
        min-height: 300px;
        max-height: 40vh;
    }

    .drill-map {
        min-height: 300px;
    }
}

/* ===== Muster Point Statistics Section ===== */
.muster-point-stats-section {
    margin-bottom: 25px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.muster-stats-title {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.muster-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.muster-stat-card {
    background: #1e293b;
    padding: 18px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 4px solid #6b7280;
    transition: all 0.3s ease;
}

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

.muster-stat-card.muster-office {
    border-left-color: #3b82f6; /* Blue */
    background: linear-gradient(135deg, #1e293b 0%, #1e3a5f 100%);
}

.muster-stat-card.muster-dock {
    border-left-color: #06b6d4; /* Cyan */
    background: linear-gradient(135deg, #1e293b 0%, #164e5d 100%);
}

.muster-stat-card.muster-pipeyard {
    border-left-color: #f59e0b; /* Orange */
    background: linear-gradient(135deg, #1e293b 0%, #3d2f1f 100%);
}

.muster-stat-icon {
    font-size: 32px;
    flex-shrink: 0;
    line-height: 1;
}

.muster-stat-content {
    flex: 1;
}

.muster-stat-label {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 4px;
    font-weight: 500;
}

.muster-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #f1f5f9;
    font-family: 'Courier New', monospace;
}

/* Responsive design for muster point stats */
@media (max-width: 768px) {
    .muster-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    /* Touch-friendly elements */
    .btn,
    .filter-btn,
    .search-input,
    .filter-select {
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    }

    /* Better scrolling */
    .table-side {
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent text selection on buttons */
    .btn,
    .filter-btn {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* GPS Data Table Styles */
.gps-fresh {
    background-color: rgba(34, 197, 94, 0.1) !important; /* Green tint for fresh GPS */
}

.gps-moderate {
    background-color: rgba(251, 191, 36, 0.1) !important; /* Yellow tint for moderate age */
}

.gps-stale {
    background-color: rgba(239, 68, 68, 0.1) !important; /* Red tint for stale GPS */
}

#gpsTable code {
    background-color: #1e293b;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #22d3ee;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
}

.location-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.location-gps,
.location-geofence {
    background-color: #22c55e;
    color: #fff;
}

.location-beacon {
    background-color: #3b82f6;
    color: #fff;
}
