/* Add these to your existing style.css file */

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    min-height: 36px;
}

.spinner {
    animation: spin 1s linear infinite;
    height: 1.25rem;
    width: 1.25rem;
    color: #F97316;
    border: 2px solid #F97316;
    border-top: 2px solid transparent;
    border-radius: 50%;
}

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

/* Canvas and Image Annotation */
#image-container {
    position: relative;
    display: inline-block;
}

#annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: auto;
    z-index: 10;
}

#annotation-canvas.hidden {
    pointer-events: none;
}

/* Multi-select dropdown styling fix */
select[multiple] {
    background-color: white !important;
    color: #374151 !important;
}

select[multiple] option {
    background-color: white !important;
    color: #374151 !important;
    padding: 4px 8px;
}

select[multiple] option:hover {
    background-color: #F3F4F6 !important;
    color: #374151 !important;
}

select[multiple] option:checked {
    background-color: #F97316 !important;
    color: white !important;
}

/* Dark mode support for multi-select */
.dark select[multiple] {
    background-color: #374151 !important;
    color: #F9FAFB !important;
    border-color: #6B7280 !important;
}

.dark select[multiple] option {
    background-color: #374151 !important;
    color: #F9FAFB !important;
}

.dark select[multiple] option:hover {
    background-color: #4B5563 !important;
    color: #F9FAFB !important;
}

.dark select[multiple] option:checked {
    background-color: #F97316 !important;
    color: white !important;
}

/* Fix for all form inputs and selects */
.form-input, 
select:not([multiple]),
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea {
    background-color: white !important;
    color: #374151 !important;
    border: 1px solid #D1D5DB !important;
}

.form-input:focus,
select:not([multiple]):focus,
input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="file"]:focus,
textarea:focus {
    border-color: #F97316 !important;
    ring-color: #F97316 !important;
    background-color: white !important;
    color: #374151 !important;
}

/* Dark mode support for regular form inputs */
.dark .form-input,
.dark select:not([multiple]),
.dark input[type="text"],
.dark input[type="search"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="number"],
.dark input[type="file"],
.dark textarea {
    background-color: #374151 !important;
    color: #F9FAFB !important;
    border-color: #6B7280 !important;
}

.dark .form-input:focus,
.dark select:not([multiple]):focus,
.dark input[type="text"]:focus,
.dark input[type="search"]:focus,
.dark input[type="email"]:focus,
.dark input[type="password"]:focus,
.dark input[type="number"]:focus,
.dark input[type="file"]:focus,
.dark textarea:focus {
    background-color: #374151 !important;
    color: #F9FAFB !important;
    border-color: #F97316 !important;
}

/* Dropdown options styling */
select option {
    background-color: white !important;
    color: #374151 !important;
}

.dark select option {
    background-color: #374151 !important;
    color: #F9FAFB !important;
}

/* Mobile-first responsive utilities */
@media (max-width: 640px) {
    .responsive-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .responsive-table thead {
        display: none;
    }
    
    .responsive-table tr {
        display: block;
        border: 1px solid #e5e7eb;
        margin-bottom: 0.5rem;
        border-radius: 0.5rem;
        padding: 0.75rem;
        background: white;
    }
    
    .dark .responsive-table tr {
        background: #374151;
        border-color: #6b7280;
    }
    
    .responsive-table td {
        display: block;
        text-align: left !important;
        padding: 0.25rem 0;
        border: none;
    }
    
    .responsive-table td::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: #6b7280;
        display: inline-block;
        width: 100px;
    }
    
    .dark .responsive-table td::before {
        color: #9ca3af;
    }
}

/* Mobile-friendly buttons */
@media (max-width: 640px) {
    .btn {
        padding: 0.75rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

/* Touch-friendly form inputs */
@media (max-width: 640px) {
    .form-input,
    select,
    textarea,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="file"] {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
}

/* Mobile navigation improvements */
@media (max-width: 768px) {
    #toast-container {
        right: 1rem;
        left: 1rem;
        top: 5rem;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
    
    /* Mobile-friendly cards */
    .card {
        margin-left: 0;
        margin-right: 0;
        border-radius: 0.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 1rem;
    }
}

/* Mobile spacing adjustments */
@media (max-width: 640px) {
    .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .py-8 {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .py-12 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    .space-y-6 > * + * {
        margin-top: 1rem;
    }
    
    .space-y-8 > * + * {
        margin-top: 1.5rem;
    }
}

/* Improved mobile text readability */
@media (max-width: 640px) {
    h1 {
        font-size: 1.875rem;
        line-height: 2.25rem;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 2rem;
    }
    
    h3 {
        font-size: 1.25rem;
        line-height: 1.75rem;
    }
    
    .text-3xl {
        font-size: 1.875rem;
        line-height: 2.25rem;
    }
    
    .text-2xl {
        font-size: 1.5rem;
        line-height: 2rem;
    }
}

/* Mobile-friendly grid layouts */
@media (max-width: 640px) {
    .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .grid-cols-1.md\:grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .grid-cols-2.md\:grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* Enhanced upload button */
.upload-btn {
    background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
    transform: translateY(0);
}

.upload-btn:hover {
    background: linear-gradient(135deg, #EA580C 0%, #C2410C 100%);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
    transform: translateY(-2px);
}

.upload-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

/* Better file input styling */
input[type="file"] {
    border: 2px dashed #D1D5DB !important;
    border-radius: 0.5rem !important;
    padding: 1rem !important;
    text-align: center !important;
    background: #F9FAFB !important;
    transition: all 0.3s ease !important;
}

input[type="file"]:hover {
    border-color: #F97316 !important;
    background: #FFF7ED !important;
}

.dark input[type="file"] {
    background: #374151 !important;
    border-color: #6B7280 !important;
    color: #F9FAFB !important;
}

.dark input[type="file"]:hover {
    border-color: #F97316 !important;
    background: #4B5563 !important;
}

/* Upload page specific styles */
#id_bin {
    width: 100%;
    padding-left: 3rem;
    padding-right: 2.5rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
    background-color: white;
    color: #374151;
    border: 1px solid #D1D5DB;
    border-radius: 0.75rem;
    font-weight: 500;
    appearance: none;
    transition: all 0.2s ease;
}

.dark #id_bin {
    background-color: #374151;
    color: #F9FAFB;
    border-color: #6B7280;
}

#id_bin:focus {
    border-color: #F97316;
    ring-color: #F97316;
    outline: none;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

#id_description {
    width: 100%;
    padding-left: 3rem;
    padding-right: 1rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
    background-color: white;
    color: #374151;
    border: 1px solid #D1D5DB;
    border-radius: 0.75rem;
    resize: none;
    rows: 4;
    transition: all 0.2s ease;
    font-family: inherit;
}

.dark #id_description {
    background-color: #374151;
    color: #F9FAFB;
    border-color: #6B7280;
}

#id_description:focus {
    border-color: #F97316;
    ring-color: #F97316;
    outline: none;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

#id_description::placeholder {
    color: #9CA3AF;
}

#id_image {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

/* Drag and drop hover states */
.drag-hover {
    border-color: #F97316 !important;
    background-color: rgba(249, 115, 22, 0.05) !important;
}


/* Update the spinner styles in style.css */
.spinner {
    animation: spin 1s linear infinite;
    height: 1.25rem;
    width: 1.25rem;
    border: 3px solid rgba(249, 115, 22, 0.3);
    border-top: 3px solid #F97316;
    border-radius: 50%;
    display: inline-block;
}

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

/* Loading overlay specific styles */
#upload-loading-overlay .spinner {
    border-width: 4px;
}

.loading-progress {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Dashboard Improvements */

/* Smooth transitions for all interactive elements */
* {
    transition: all 0.2s ease;
}

/* Card hover effects */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Pulse animation for empty states */
@keyframes gentle-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

.pulse-gentle {
    animation: gentle-pulse 3s ease-in-out infinite;
}

/* Better focus states */
input:focus, select:focus, textarea:focus {
    outline: none;
    ring: 2px;
    ring-color: #F97316;
    ring-offset: 2px;
}

/* Loading skeleton animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Dark mode skeleton */
.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4B5563 50%, #374151 75%);
}

/* Custom scrollbar */
.scrollbar-thin {
    scrollbar-width: thin;
}

.scrollbar-thumb-gray-300 {
    scrollbar-color: #d1d5db transparent;
}

.dark .scrollbar-thumb-gray-600 {
    scrollbar-color: #6b7280 transparent;
}

/* Webkit scrollbar */
.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 3px;
}

.dark .scrollbar-thin::-webkit-scrollbar-thumb {
    background-color: #6b7280;
}