/* Image Mapper Mobile Optimized Styles */

/* Base Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* Image Mapper Container */
.image-mapper-container {
    position: relative;
    width: 100%;
    min-height: 300px;
    background: #fff;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-mapper-container:empty::before {
    content: "ইমেজ আপলোড করুন বা URL দিন";
    color: #6c757d;
    font-size: 1.1rem;
    text-align: center;
}

/* Image Mapper Core */
.image-mapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.image-mapper-img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
    border-radius: 8px;
}

.image-mapper-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* SVG Shapes */
.image-mapper-shape {
    fill: rgba(0, 123, 255, 0.3);
    stroke: #007bff;
    stroke-width: 2;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.2s ease;
}

.image-mapper-shape:hover {
    fill: rgba(0, 123, 255, 0.5);
    stroke-width: 3;
}

/* SVG Points */
.image-mapper-point {
    fill: #fff;
    stroke: #007bff;
    stroke-width: 2;
    cursor: grab;
    pointer-events: all;
    transition: all 0.2s ease;
}

.image-mapper-point:hover {
    fill: #007bff;
    stroke: #0056b3;
    stroke-width: 3;
    r: 6;
}

.image-mapper-point:active {
    cursor: grabbing;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .card {
        margin-bottom: 1rem;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        background: linear-gradient(135deg, #007bff, #0056b3);
        color: white;
        border-radius: 12px 12px 0 0 !important;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        border-radius: 8px;
        font-weight: 500;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 0.375rem 0.75rem;
    }
    
    /* Larger touch targets for SVG elements */
    .image-mapper-point {
        r: 8;
        stroke-width: 3;
    }
    
    .image-mapper-point:hover {
        r: 10;
    }
    
    /* Table responsiveness */
    .table-responsive {
        border-radius: 8px;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        vertical-align: middle;
        border-color: #dee2e6;
    }
    
    .form-control-sm,
    .form-select-sm {
        font-size: 0.875rem;
        border-radius: 6px;
    }
    
    /* Instructions card */
    .list-unstyled li {
        padding: 0.25rem 0;
        border-bottom: 1px solid #f8f9fa;
    }
    
    .list-unstyled li:last-child {
        border-bottom: none;
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    header h1 {
        font-size: 1.25rem !important;
    }
    
    .card-header h5,
    .card-header h6 {
        font-size: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .image-mapper-container {
        min-height: 200px;
    }
    
    .image-mapper-container:empty::before {
        font-size: 0.9rem;
        padding: 1rem;
    }
    
    /* Stack table cells vertically on very small screens */
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block;
    }
    
    .table-responsive thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .table-responsive tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
        border-radius: 8px;
        background: #f8f9fa;
    }
    
    .table-responsive td {
        border: none;
        position: relative;
        padding-left: 50% !important;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    
    .table-responsive td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: bold;
        color: #007bff;
    }
}

/* Loading and Animation States */
.image-mapper-img[src=""] {
    display: none;
}

.loading {
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Scrollbar */
pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

pre::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Accessibility Improvements */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    border-color: #80bdff;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .image-mapper-shape {
        stroke-width: 3;
        fill: rgba(0, 0, 0, 0.3);
        stroke: #000;
    }
    
    .image-mapper-point {
        stroke: #000;
        stroke-width: 3;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .image-mapper-shape,
    .image-mapper-point,
    .btn {
        transition: none;
    }
    
    .loading::after {
        animation: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #fff;
    }
    
    .card {
        background-color: #2d2d2d;
        border-color: #404040;
    }
    
    .image-mapper-container {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .image-mapper-container:empty::before {
        color: #adb5bd;
    }
    
    .bg-light {
        background-color: #2d2d2d !important;
        color: #fff;
    }
}