/* Robot Control System - Custom Styles */

/* Page Content Styles */
.page-content {
    transition: opacity 0.3s ease-in-out;
}

.page-content.hidden {
    display: none;
}

/* Status Indicators */
.status-indicator {
    animation: pulse 2s infinite;
}

.status-indicator.critical {
    animation: pulse 1s infinite;
}

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

/* Robot Cards */
.robot-card:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease-in-out;
}



/* Metric Cards */
.metric-card {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

/* Control Buttons */
.control-button {
    min-height: 44px;
    min-width: 120px;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Additional Utility Classes */
.transition-all-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.shadow-soft {
    box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.05);
}

.shadow-soft-hover:hover {
    box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.1);
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Status Badge Colors */
.badge-operational {
    @apply bg-emerald-100 text-emerald-800;
}

.badge-warning {
    @apply bg-amber-100 text-amber-800;
}

.badge-error {
    @apply bg-red-100 text-red-800;
}

.badge-maintenance {
    @apply bg-indigo-100 text-indigo-800;
}

.badge-offline {
    @apply bg-gray-100 text-gray-800;
}

/* Chart Container Styles */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Mobile Responsive Improvements */
@media (max-width: 1024px) {
    /* Tablet and Mobile - Hide sidebar by default */
    .sidebar-mobile {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        z-index: 50;
        background: white;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-mobile.open {
        transform: translateX(0);
    }
    
    /* Adjust main content when sidebar is hidden */
    .flex.min-h-screen {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    /* Mobile tablet adjustments */
    .robot-card {
        padding: 0.875rem;
    }
    
    .metric-card .card-body {
        padding: 1rem;
    }
    
    .control-button {
        min-width: 100px;
        font-size: 0.875rem;
        min-height: 40px;
    }
    
    /* Chart containers for mobile */
    #performanceChart {
        height: 300px !important;
    }
    
    /* Header adjustments */
    .header-mobile h2 {
        font-size: 1.25rem;
    }
    
    .header-mobile .text-sm {
        font-size: 0.75rem;
    }
}

@media (max-width: 640px) {
    /* Mobile phone adjustments */

    
    /* Mobile sidebar refinements */
    .sidebar-mobile {
        width: 280px;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.15);
    }
    
    /* Mobile header */
    .header-mobile {
        padding: 1rem;
    }
    
    .header-mobile h2 {
        font-size: 1.125rem;
    }
    
    /* Mobile main content */
    .main-mobile {
        padding: 1rem;
    }
    
    /* Mobile metric cards */
    .metric-card .card-body {
        padding: 0.875rem;
    }
    
    .metric-card h3 {
        font-size: 0.75rem;
    }
    
    .metric-card .text-3xl {
        font-size: 1.875rem;
    }
    
    /* Mobile robot cards */
    .robot-card {
        padding: 0.75rem;
    }
    
    .robot-card h4 {
        font-size: 0.875rem;
    }
    
    .robot-card .text-sm {
        font-size: 0.75rem;
    }
    
    /* Mobile charts */
    #performanceChart {
        height: 250px !important;
    }
    
    /* Mobile buttons */
    .control-button {
        min-width: 80px;
        font-size: 0.75rem;
        min-height: 36px;
        padding: 0.5rem 0.75rem;
    }
    
    /* Mobile emergency button */
    .btn-error.control-button {
        min-width: 100px;
    }
    
    /* Mobile dropdown */
    .dropdown-end .dropdown-content {
        right: 0;
        left: auto;
    }
}

@media (max-width: 480px) {
    /* Small mobile adjustments */
    .main-mobile {
        padding: 0.75rem;
    }
    
    .header-mobile {
        padding: 0.75rem;
    }
    
    .header-mobile h2 {
        font-size: 1rem;
    }
    
    /* Very small mobile cards */
    .metric-card .card-body {
        padding: 0.75rem;
    }
    
    .robot-card {
        padding: 0.625rem;
    }
    
    /* Smaller charts for very small screens */
    #performanceChart {
        height: 200px !important;
    }
    
    /* Mobile alert list */
    .space-y-3 > * + * {
        margin-top: 0.5rem;
    }
}

/* Print Styles */
@media print {
    .control-button,
    .dropdown,
    .modal {
        display: none !important;
    }
    
    .robot-card,
    .metric-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .status-indicator {
        border: 2px solid currentColor;
    }
    
    .robot-card {
        border: 2px solid #374151;
    }
    
    .metric-card {
        border: 2px solid #374151;
        background: #ffffff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .status-indicator,
    .robot-card:hover {
        animation: none;
        transition: none;
        transform: none;
    }
}

/* Focus Styles for Accessibility */
.btn:focus,
.robot-card:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Dark Mode Preparation (for future use) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1f2937;
        --bg-secondary: #374151;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --border-color: #4b5563;
    }
}

/* Robot Location Canvas Styles */
#robotLocationCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    cursor: crosshair;
}

.canvas-container {
    position: relative;
    overflow: hidden;
}

/* Dashboard Performance Chart */
#performanceChartDashboard {
    min-height: 350px;
}

/* Chart.js Canvas Styles */
#errorRateChart,
#usageTimeChart,
#dailyTaskChart,
#systemOverviewChart {
    max-width: 100%;
    height: auto;
}

.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

.chart-container canvas {
    max-height: 300px;
}

/* Dashboard Chart Cards */
.dashboard-chart-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.dashboard-chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Mobile Canvas Responsiveness */
@media (max-width: 768px) {
    #robotLocationCanvas {
        height: 300px !important;
    }
    
    /* Mobile Chart Adjustments */
    .chart-container {
        height: 250px;
    }
    
    .chart-container canvas {
        max-height: 250px;
    }
    
    #errorRateChart,
    #usageTimeChart,
    #dailyTaskChart,
    #systemOverviewChart {
        height: 250px !important;
    }
    
    #performanceChartDashboard {
        min-height: 250px;
    }
}

@media (max-width: 480px) {
    #robotLocationCanvas {
        height: 250px !important;
    }
    
    /* Small Mobile Chart Adjustments */
    .chart-container {
        height: 200px;
        margin: 0.5rem 0;
    }
    
    .chart-container canvas {
        max-height: 200px;
    }
    
    #errorRateChart,
    #usageTimeChart,
    #dailyTaskChart,
    #systemOverviewChart {
        height: 200px !important;
    }
    
    #performanceChartDashboard {
        min-height: 200px;
    }
    
    /* Dashboard header responsive */
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .dashboard-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .dashboard-controls select,
    .dashboard-controls button {
        width: 100%;
    }
}

/* Work Log Table Styles */
.work-log-table {
    font-size: 0.875rem;
}

.work-log-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #374151;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.work-log-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.work-log-table tr:hover {
    background-color: #f9fafb;
}

.work-log-date-header {
    background-color: #f1f5f9;
    color: #1e293b;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}



/* Work Log Mobile Styles */
@media (max-width: 768px) {
    .work-log-table {
        font-size: 0.75rem;
    }
    
    .work-log-table th,
    .work-log-table td {
        padding: 0.5rem;
    }
    

    
    .work-log-date-header {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .work-log-table {
        font-size: 0.7rem;
    }
    
    .work-log-table th,
    .work-log-table td {
        padding: 0.375rem;
    }
    

    
    /* Hide less important columns on very small screens */
    .work-log-table th:nth-child(4),
    .work-log-table td:nth-child(4),
    .work-log-table th:nth-child(6),
    .work-log-table td:nth-child(6) {
        display: none;
    }
}

/* Custom Alert Colors */
.alert-gray {
    background-color: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.alert-gray .badge {
    background-color: #6b7280;
    color: white;
}

.alert-error-dark {
    background-color: #991b1b;
    border-color: #7f1d1d;
    color: white;
}

.alert-error-dark .badge {
    background-color: #dc2626;
    color: white;
}

/* Dashboard Styles */
#dashboardChartsContainer {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Card Styles */
#dashboardChartsContainer .card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

#dashboardChartsContainer .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Chart Container */
#dashboardChartsContainer canvas {
    max-height: 100%;
}

/* Top Errors Table Styles */
#topErrorsTableBody .badge {
    font-weight: 600;
}

#topErrorsTableBody tr:hover {
    background-color: #f9fafb;
}

/* Loading State */
#dashboardLoading {
    min-height: 400px;
}

/* Error State */
#dashboardError {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive Adjustments for Dashboard */
@media (max-width: 1024px) {
    /* 2-column layout for tablets */
    #dashboardChartsContainer .grid.lg\\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #dashboardChartsContainer .grid.lg\\:grid-cols-2 {
        grid-template-columns: repeat(1, 1fr);
    }
}

@media (max-width: 768px) {
    /* Single column layout for mobile */
    #dashboardChartsContainer .grid {
        grid-template-columns: repeat(1, 1fr);
    }
    
    /* Reduce chart heights on mobile */
    #dashboardChartsContainer .card-body > div[style*="height"] {
        height: 250px !important;
    }
    
    /* Smaller period selector on mobile */
    #periodSelect {
        width: 100%;
    }
}

@media (max-width: 640px) {
    /* Further mobile optimizations */
    #dashboardChartsContainer .card-body {
        padding: 1rem;
    }
    
    #dashboardChartsContainer h3 {
        font-size: 1rem;
    }
    
    /* Compact table on mobile */
    #topErrorsTableBody td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}
