/* Custom styles for AutoSdelka */

/* Screen reader only - hide visually */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* HTMX indicators */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-request.htmx-indicator {
    opacity: 1;
}

/* Loading animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Table row hover effects */
.table-hover tbody tr {
    transition: background-color 0.2s ease;
}

/* Form validation styles */
input:invalid, select:invalid, textarea:invalid {
    border-color: #f87171;
}

input:valid, select:valid, textarea:valid {
    border-color: #34d399;
}

/* Focus styles */
.focus-ring {
    @apply focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500;
}

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

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

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    table {
        page-break-inside: avoid;
    }
}

/* Contract document styles */
.contract-document {
    font-family: 'Times New Roman', Times, serif;
    line-height: 1.6;
}

.contract-header {
    border-bottom: 2px solid #333;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.contract-section {
    margin-bottom: 1.5rem;
}

.contract-clause {
    margin-bottom: 1rem;
}

.contract-signature {
    margin-top: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #ccc;
}

/* Status colors */
.status-draft {
    @apply bg-gray-100 text-gray-800;
}

.status-active {
    @apply bg-green-100 text-green-800;
}

.status-pending {
    @apply bg-yellow-100 text-yellow-800;
}

.status-signed {
    @apply bg-blue-100 text-blue-800;
}

.status-cancelled {
    @apply bg-red-100 text-red-800;
}

.status-expired {
    @apply bg-orange-100 text-orange-800;
}

/* Responsive table */
.responsive-table {
    @apply block w-full overflow-x-auto;
}

/* Utility classes */
.text-balance {
    text-wrap: balance;
}

/* Animation for new items */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Toast animations */
@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-enter {
    animation: toastIn 0.3s ease-out;
}

.toast-exit {
    animation: toastOut 0.3s ease-in;
}

/* Mobile menu animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu-enter {
    animation: slideDown 0.2s ease-out;
}

/* Custom transitions */
.transition-all-200 {
    transition: all 0.2s ease;
}

.transition-all-300 {
    transition: all 0.3s ease;
}

.transition-all-500 {
    transition: all 0.5s ease;
}

/* Gradient backgrounds */
.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #34d399 0%, #059669 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
}

/* Shadow utilities */
.shadow-soft {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.shadow-medium {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.shadow-hard {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Border utilities */
.border-light {
    border-color: rgba(0, 0, 0, 0.05);
}

.border-medium {
    border-color: rgba(0, 0, 0, 0.1);
}

.border-heavy {
    border-color: rgba(0, 0, 0, 0.2);
}

/* Typography utilities */
.text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

/* Loading skeleton */
.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;
    }
}

/* Responsive text sizes */
.text-responsive {
    font-size: clamp(1rem, 2vw, 1.25rem);
}

/* Aspect ratio containers */
.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

/* Custom file input */
.custom-file-input {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.custom-file-input input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

/* Tooltip styles */
.tooltip {
    position: relative;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Badge variants */
.badge-sm {
    @apply px-2 py-0.5 text-xs rounded-full;
}

.badge-md {
    @apply px-2.5 py-0.5 text-sm rounded-full;
}

.badge-lg {
    @apply px-3 py-1 text-base rounded-full;
}

/* Button variants */
.btn-icon {
    @apply p-2 rounded-full hover:bg-gray-100 transition-colors;
}

.btn-icon-sm {
    @apply p-1 rounded-md hover:bg-gray-100 transition-colors;
}

/* Form group spacing */
.form-group {
    @apply space-y-2;
}

/* Container utilities */
.container-narrow {
    @apply max-w-4xl mx-auto;
}

.container-wide {
    @apply max-w-7xl mx-auto;
}

/* Spacing utilities */
.space-y-reverse > * + * {
    margin-top: 0;
    margin-bottom: 1rem;
}

.space-x-reverse > * + * {
    margin-left: 0;
    margin-right: 1rem;
}

/* Custom focus for dark mode */
@media (prefers-color-scheme: dark) {
    .focus-ring-dark {
        @apply focus:ring-blue-400;
    }
}