/* Industrial Maintenance System Custom Styles */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #17a2b8;
    --light-gray: #ecf0f1;
    --dark-gray: #7f8c8d;
    
    /* Mobile-first responsive spacing */
    --mobile-padding: 1rem;
    --tablet-padding: 1.5rem;
    --desktop-padding: 2rem;
    
    /* Touch-friendly sizes */
    --touch-target-size: 44px;
    --mobile-font-size: 16px;
    --mobile-line-height: 1.5;
}

/* Mobile-first responsive design */
* {
    box-sizing: border-box;
}

html {
    font-size: var(--mobile-font-size);
    line-height: var(--mobile-line-height);
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Body and Layout */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Navigation - Mobile First */
.navbar {
    padding: 0.5rem 1rem;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.1rem;
    padding: 0.5rem 0;
}

.navbar-toggler {
    padding: 0.4rem 0.6rem;
    font-size: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    min-height: var(--touch-target-size);
    min-width: var(--touch-target-size);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.navbar-nav {
    padding: 0.5rem 0;
}

.navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    margin: 0.2rem 0;
    border-radius: 6px;
    transition: all 0.2s ease;
    min-height: var(--touch-target-size);
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

.navbar-nav .nav-link i {
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
}

.navbar-collapse {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

/* Desktop Navigation */
@media (min-width: 992px) {
    .navbar {
        padding: 0.5rem 1.5rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .navbar-collapse {
        border-top: none;
        margin-top: 0;
        padding-top: 0;
    }
    
    .navbar-nav {
        padding: 0;
        flex-direction: row;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
        margin: 0 0.2rem;
        min-height: auto;
    }
    
    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link:focus {
        transform: none;
    }
}

/* Cards - Mobile First */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    border-bottom: none;
    border-radius: 8px 8px 0 0 !important;
    font-weight: 600;
    padding: 1rem;
    font-size: 1rem;
}

.card-body {
    padding: 1rem;
}

.card-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.card-text {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Desktop Cards */
@media (min-width: 768px) {
    .card {
        margin-bottom: 1.5rem;
    }
    
    .card-header {
        padding: 1.25rem;
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .card-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
}

.card-header h5,
.card-header h6 {
    color: white;
}

/* Dashboard Cards */
.card.bg-primary,
.card.bg-danger,
.card.bg-warning,
.card.bg-info,
.card.bg-secondary,
.card.bg-success {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Touch-friendly buttons - Mobile First */
.btn {
    min-height: var(--touch-target-size);
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn:focus,
.btn:active {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    transform: translateY(1px);
}

.btn:active {
    transform: translateY(2px);
}

.btn i {
    margin-right: 0.5rem;
}

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

.btn-lg {
    min-height: 52px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Button groups for mobile */
.btn-group-vertical .btn {
    margin-bottom: 0.5rem;
    width: 100%;
}

.btn-group-vertical .btn:last-child {
    margin-bottom: 0;
}

/* Desktop buttons */
@media (min-width: 768px) {
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        min-height: auto;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 0;
        width: auto;
    }
}

/* Forms - Mobile First */
.form-control,
.form-select {
    min-height: var(--touch-target-size);
    padding: 0.75rem;
    font-size: 1rem;
    border-radius: 6px;
    border: 2px solid #dee2e6;
    transition: all 0.2s ease;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
    outline: none;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--primary-color);
}

.form-check {
    padding: 0.75rem 0;
}

.form-check-input {
    width: 20px;
    height: 20px;
    margin-top: 0.1rem;
    margin-right: 0.75rem;
}

.form-check-label {
    font-size: 0.95rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Input groups */
.input-group {
    margin-bottom: 1rem;
}

.input-group .btn {
    border-radius: 0 6px 6px 0;
}

.input-group .form-control {
    border-radius: 6px 0 0 6px;
}

/* Desktop forms */
@media (min-width: 768px) {
    .form-control,
    .form-select {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        min-height: auto;
    }
    
    .form-check {
        padding: 0.5rem 0;
    }
}

/* Tables - Mobile First (Card-based on mobile, table on desktop) */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-card-table {
    display: block;
}

.mobile-card-table .table {
    display: none;
}

.mobile-card-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--accent-color);
}

.mobile-card-item .card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.mobile-card-item .card-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.mobile-card-item .card-field:last-child {
    border-bottom: none;
}

.mobile-card-item .field-label {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 0.875rem;
}

.mobile-card-item .field-value {
    color: var(--primary-color);
    font-size: 0.875rem;
}

.mobile-card-item .card-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mobile-card-item .card-actions .btn {
    flex: 1;
    min-width: 80px;
}

/* Desktop tables */
@media (min-width: 768px) {
    .mobile-card-table .table {
        display: table;
    }
    
    .mobile-card-item {
        display: none;
    }
    
    .table {
        border-radius: 8px;
        overflow: hidden;
    }
    
    .table th {
        background-color: var(--primary-color);
        color: white;
        border: none;
        padding: 1rem;
        font-weight: 600;
        font-size: 0.875rem;
    }
    
    .table td {
        padding: 0.75rem 1rem;
        border-color: #dee2e6;
        vertical-align: middle;
    }
    
    .table tbody tr:hover {
        background-color: rgba(52, 152, 219, 0.05);
    }
}

/* Modals - Touch-friendly */
.modal-dialog {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
}

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

.btn-close {
    filter: invert(1);
    opacity: 0.8;
}

/* Desktop modals */
@media (min-width: 768px) {
    .modal-dialog {
        margin: 1.75rem auto;
        max-width: 500px;
    }
}

@media (min-width: 992px) {
    .modal-dialog {
        max-width: 800px;
    }
}

/* Dashboard stats cards hover effects */
.card.bg-primary:hover,
.card.bg-danger:hover,
.card.bg-warning:hover,
.card.bg-info:hover,
.card.bg-secondary:hover,
.card.bg-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Container and layout - Mobile First */
.container-fluid {
    padding: 0.5rem;
}

.container {
    padding: 0.5rem;
}

/* Desktop containers */
@media (min-width: 768px) {
    .container-fluid {
        padding: 1rem;
    }
    
    .container {
        padding: 1rem;
    }
}

@media (min-width: 1200px) {
    .container-fluid {
        padding: 1.5rem;
    }
}

/* Mobile-friendly spacing */
.mb-mobile {
    margin-bottom: 1rem;
}

.mt-mobile {
    margin-top: 1rem;
}

.p-mobile {
    padding: 1rem;
}

/* Row spacing */
.row {
    margin: 0 -0.5rem;
}

.row > [class*="col-"] {
    padding: 0 0.5rem;
}

@media (min-width: 768px) {
    .row {
        margin: 0 -0.75rem;
    }
    
    .row > [class*="col-"] {
        padding: 0 0.75rem;
    }
}

/* Badges - Touch-friendly */
.badge {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
}

/* Alerts - Mobile optimized */
.alert {
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.alert-dismissible .btn-close {
    padding: 1rem;
    filter: none;
    opacity: 1;
}

/* Floating action button for mobile */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 1rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Hide fab on desktop */
@media (min-width: 768px) {
    .fab {
        display: none;
    }
}

/* Breadcrumb - Mobile friendly */
.breadcrumb {
    background: transparent;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: var(--dark-gray);
    font-weight: bold;
}

/* Pagination - Touch-friendly */
.pagination {
    justify-content: center;
    margin-top: 2rem;
}

.page-link {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
    margin: 0 0.25rem;
    min-height: var(--touch-target-size);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    border: 1px solid #dee2e6;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-link:hover,
.page-link:focus {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Desktop pagination */
@media (min-width: 768px) {
    .page-link {
        padding: 0.5rem 0.75rem;
        min-height: auto;
    }
}

/* Status indicators - Enhanced visibility */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-indicator::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
    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 var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility classes for mobile */
.d-mobile-none {
    display: none;
}

.d-mobile-block {
    display: block;
}

.d-mobile-flex {
    display: flex;
}

@media (min-width: 768px) {
    .d-mobile-none {
        display: block;
    }
    
    .d-mobile-block {
        display: none;
    }
    
    .d-mobile-flex {
        display: none;
    }
}

/* Text utilities for mobile */
.text-mobile-center {
    text-align: center;
}

.text-mobile-left {
    text-align: left;
}

@media (min-width: 768px) {
    .text-mobile-center {
        text-align: left;
    }
}
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Badges */
.badge {
    font-size: 0.75em;
    font-weight: 500;
}

/* Tables */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table-hover tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

.table thead th {
    background-color: var(--light-gray);
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-group-sm .btn {
    border-radius: 4px;
}

/* Forms */
.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #ddd;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--light-gray);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.timeline-content {
    background-color: white;
    padding: 0.75rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Status Indicators */
.status-active {
    color: var(--success-color);
}

.status-stopped {
    color: var(--danger-color);
}

.status-maintenance {
    color: var(--warning-color);
}

/* Stock Status */
.stock-ok {
    color: var(--success-color);
}

.stock-low {
    color: var(--warning-color);
}

.stock-empty {
    color: var(--danger-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Alert Enhancements */
.alert {
    border: none;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-primary {
    border-left-color: var(--accent-color);
}

.alert-success {
    border-left-color: var(--success-color);
}

.alert-warning {
    border-left-color: var(--warning-color);
}

.alert-danger {
    border-left-color: var(--danger-color);
}

.alert-info {
    border-left-color: var(--info-color);
}

/* Modal Enhancements */
.modal-content {
    border: none;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    border-bottom: 1px solid var(--light-gray);
    border-radius: 8px 8px 0 0;
}

.modal-footer {
    border-top: 1px solid var(--light-gray);
    border-radius: 0 0 8px 8px;
}

/* Pagination */
.pagination {
    margin: 0;
}

.page-link {
    border-radius: 6px;
    margin: 0 2px;
    border: 1px solid var(--light-gray);
    color: var(--primary-color);
}

.page-link:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Footer */
footer {
    margin-top: auto;
    background-color: var(--primary-color) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .btn-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .timeline {
        padding-left: 1.5rem;
    }
    
    .timeline-marker {
        left: -1.5rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .pagination,
    footer {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .card-header {
        background-color: #f8f9fa !important;
        color: #333 !important;
    }
}

/* Custom utilities */
.text-industrial {
    color: var(--primary-color);
}

.bg-industrial {
    background-color: var(--primary-color);
}

.border-industrial {
    border-color: var(--primary-color);
}

.shadow-sm-custom {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.shadow-custom {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Loading spinner */
.spinner-border-sm-custom {
    width: 1rem;
    height: 1rem;
}

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

canvas {
    border-radius: 8px;
}

/* Dashboard specific */
.dashboard-card {
    transition: all 0.3s ease;
}

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

/* Equipment status colors */
.equipment-active {
    border-left: 4px solid var(--success-color);
}

.equipment-stopped {
    border-left: 4px solid var(--danger-color);
}

.equipment-maintenance {
    border-left: 4px solid var(--warning-color);
}

/* Work order priority colors */
.priority-low {
    border-left: 4px solid var(--success-color);
}

.priority-medium {
    border-left: 4px solid var(--info-color);
}

.priority-high {
    border-left: 4px solid var(--warning-color);
}

.priority-urgent {
    border-left: 4px solid var(--danger-color);
}
