/* Dodatkowe style dla System Katalogowy Komponentów */

/* Style podstawowe */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Poprawki do scrollbarów */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

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

/* Animacje dla modalów */
.modal-enter {
    animation: modalEnter 0.3s ease-out forwards;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Hover effects dla kart */
.card-hover {
    transition: all 0.3s ease;
}

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

/* Loading indicator */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #cbd5e1;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive improvements */
@media (max-width: 1024px) {
    /* Tablet styles */
    .container {
        padding: 0 1rem;
    }

    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Mobile tablet styles */
    .grid-responsive {
        grid-template-columns: 1fr;
    }

    .flex-responsive {
        flex-direction: column;
        gap: 1rem;
    }

    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4,
    .grid-cols-6 {
        grid-template-columns: 1fr;
    }

    /* Form styles dla mobile */
    .form-grid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    /* Modal adjustments */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        width: calc(100% - 2rem);
    }

    /* Table responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    /* Button adjustments */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group button {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 640px) {
    /* Mobile phone styles */
    body {
        font-size: 14px;
    }

    .container {
        padding: 0 0.5rem;
    }

    /* Header mobile */
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    /* Card adjustments */
    .card {
        margin-bottom: 1rem;
        padding: 0.75rem;
    }

    /* Input fields */
    input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }

    /* Navigation mobile */
    .nav-mobile {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e2e8f0;
        padding: 0.5rem;
        z-index: 50;
    }

    .nav-mobile-item {
        flex: 1;
        text-align: center;
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    /* Modal full screen na mobile */
    .modal-mobile-full {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        border-radius: 0;
        max-width: none;
        max-height: none;
        height: 100vh;
        width: 100vw;
    }

    /* Search improvements */
    .search-mobile {
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        padding: 0.5rem;
        border-bottom: 1px solid #e2e8f0;
    }

    /* Floating action button */
    .fab {
        position: fixed;
        bottom: 80px;
        right: 1rem;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #3b82f6;
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        z-index: 40;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    /* Extra small mobile */
    .container {
        padding: 0 0.25rem;
    }

    /* Smaller text */
    .text-sm {
        font-size: 0.75rem;
    }

    /* Compact spacing */
    .space-y-4 > * + * {
        margin-top: 0.75rem;
    }

    .space-y-2 > * + * {
        margin-top: 0.375rem;
    }

    /* Image adjustments */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Table mobile scroll */
    .table-mobile-scroll {
        display: block;
        white-space: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Camera modal styles */
#cameraModal {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#cameraVideo {
    -webkit-transform: scaleX(-1);
    transform: scaleX(-1); /* Mirror effect for front camera */
}

#cameraModal video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Camera controls */
.camera-controls {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.camera-btn {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.camera-btn:active {
    transform: scale(0.95);
}

/* Prevent scrolling when camera is open */
body.camera-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .hover\:bg-gray-50:hover {
        background-color: #f9fafb;
    }

    button, .btn {
        min-height: 44px; /* Apple's recommended touch target */
        min-width: 44px;
    }

    .card-hover:hover {
        transform: none; /* Remove hover effects on touch */
    }

    .touch-action-pan-y {
        touch-action: pan-y;
    }

    .touch-action-pan-x {
        touch-action: pan-x;
    }

    /* Camera specific touch improvements */
    #cameraModal button {
        min-height: 48px;
        min-width: 48px;
    }

    .camera-controls button {
        min-height: 56px;
        min-width: 56px;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        line-height: 1.4;
    }

    .shadow-lg,
    .shadow-xl {
        box-shadow: none !important;
    }

    /* Print styles dla modala podglądu detalu */
    #detailPreviewModal {
        position: static !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #detailPreviewModal .bg-white {
        box-shadow: none !important;
        border-radius: 0 !important;
        max-width: none !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Popraw kolory dla druku */
    .bg-slate-50,
    .bg-slate-100,
    .bg-blue-50 {
        background: #f8f9fa !important;
        border: 1px solid #dee2e6 !important;
    }

    .text-slate-700,
    .text-slate-800,
    .text-blue-800 {
        color: #212529 !important;
    }

    .text-slate-500,
    .text-slate-600 {
        color: #6c757d !important;
    }

    /* Layout adjustments dla druku */
    .grid {
        display: block !important;
    }

    .grid > div {
        margin-bottom: 20px;
    }

    .flex {
        display: block !important;
    }

    /* Obrazy w druku */
    img {
        max-width: 100% !important;
        height: auto !important;
        break-inside: avoid;
    }

    /* Zakładki w druku */
    .tab-content.hidden {
        display: block !important;
    }

    .border-b button {
        display: inline-block;
        margin-right: 10px;
        padding: 5px 10px;
        border: 1px solid #dee2e6;
        background: #f8f9fa;
        font-weight: bold;
    }
}