/* Global styles */
* {
    font-family: 'Roboto', -apple-system, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
}

h1, h2, h3, h4, h5, h6 {
    font-size: inherit;
}

.text-xs, [class*="text-[10px]"], [class*="text-[11px]"], [class*="text-[12px]"], [class*="text-[13px]"] {
    font-size: inherit !important;
}

/* Animations */
@keyframes swing {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

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

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-swing {
    animation: swing 2s ease-in-out infinite;
}

.animate-spin-slow {
    animation: spin-slow 3s linear infinite;
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

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

.animate-fade-in-down {
    animation: fadeInDown 0.2s ease-out;
}

@keyframes stripes {
    0% { background-position: 0 0; }
    100% { background-position: 40px 0; }
}

.animate-stripes {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 40px 40px;
    animation: stripes 1s linear infinite;
}

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

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-right {
    animation: slideInRight 0.4s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes progress-flow {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Scrollbar utilities */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* FullCalendar styles */
.fc {
    font-family: system-ui, -apple-system, sans-serif;
}

.fc-theme-standard td, .fc-theme-standard th {
    border: 1px solid #ddd;
}

.fc-scrollgrid {
    border: 1px solid #ddd;
}

.fc table {
    font-size: 1em;
    border-collapse: collapse;
}

.fc td, .fc th {
    vertical-align: top;
    padding: 0;
}

.fc-direction-ltr .fc-button-group > .fc-button:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.fc-direction-ltr .fc-button-group > .fc-button:not(:first-child) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

.fc-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fc-toolbar-chunk {
    display: flex;
    align-items: center;
}

.fc-toolbar-title {
    font-size: 1.75em;
    margin: 0 10px;
}

.fc-daygrid-day-frame {
    position: relative;
    min-height: 100%;
}

.fc-daygrid-day-top {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
}

.fc-daygrid-day-number {
    padding: 4px;
}

.fc-daygrid-event {
    position: relative;
    white-space: nowrap;
    border-radius: 3px;
    font-size: 0.85em;
}

.fc-event {
    display: block;
    font-size: 0.85em;
    line-height: 1.4;
    border: 1px solid;
}

.fc-event-main {
    position: relative;
    z-index: 1;
}

.fc-more-link {
    cursor: pointer;
    font-size: 0.85em;
    padding: 1px 3px;
    text-decoration: underline;
}

.fc .fc-button {
    background: #ff6600 !important;
    border: none !important;
    border-radius: 0 !important;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.05em;
    padding: 8px 16px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
    transition: all 0.2s;
}

.fc .fc-button:hover {
    background: #e55a00 !important;
}

.fc .fc-button:disabled {
    background: #9ca3af !important;
    opacity: 0.5;
}

.fc .fc-button-primary:not(:disabled).fc-button-active {
    background: #dc2626 !important;
}

.fc-theme-standard .fc-scrollgrid {
    border-color: #d1d5db !important;
}

.fc-theme-standard td,
.fc-theme-standard th {
    border-color: #e5e7eb !important;
}

.fc .fc-col-header-cell {
    background: #f3f4f6;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    color: #374151;
    padding: 12px 4px;
}

.fc .fc-daygrid-day-number {
    font-weight: 600;
    color: #1f2937;
    padding: 8px;
}

.fc .fc-daygrid-day.fc-day-today {
    background-color: #fef3c7 !important;
}

.fc .fc-event {
    border-radius: 0 !important;
    padding: 2px 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-width: 0 0 0 3px !important;
}

.fc .fc-event:hover {
    opacity: 0.85;
}

.fc .fc-toolbar-title {
    font-size: 20px !important;
    font-weight: 700;
    text-transform: uppercase;
    color: #1f2937;
    letter-spacing: 0.025em;
}

.fc .fc-daygrid-event-harness {
    margin-bottom: 2px;
}

.fc-direction-ltr .fc-daygrid-event.fc-event-start,
.fc-direction-rtl .fc-daygrid-event.fc-event-end {
    margin-left: 2px;
}

.fc-direction-ltr .fc-daygrid-event.fc-event-end,
.fc-direction-rtl .fc-daygrid-event.fc-event-start {
    margin-right: 2px;
}

.fc .fc-more-link {
    color: #ff6600;
    font-weight: 600;
    font-size: 11px;
}

.fc .fc-more-link:hover {
    color: #e55a00;
}

/* Form elements */
.order-checkbox,
.filter-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #9ca3af;
    border-radius: 3px;
    background-color: white;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.order-checkbox:checked,
.filter-checkbox:checked {
    background-color: #f97316;
    border-color: #f97316;
}

.order-checkbox:checked::after,
.filter-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.order-checkbox:hover,
.filter-checkbox:hover {
    border-color: #6b7280;
}

/* Progress bars */
.progress-bar-stripes {
    background: linear-gradient(
        90deg,
        #3b82f6 0%,
        #60a5fa 25%,
        #3b82f6 50%,
        #60a5fa 75%,
        #3b82f6 100%
    );
    background-size: 200% 100%;
    animation: progress-flow 1.5s linear infinite;
}

/* Responsive utilities */
@media (max-width: 1024px) {
    .p-responsive {
        padding: 1rem !important;
    }
    
    .grid-responsive {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .text-responsive {
        font-size: 12px !important;
    }
    
    button, .btn, a[class*="btn"] {
        min-height: 44px;
    }
    
    body {
        overflow-x: hidden;
    }
}

/* Orders dashboard table */
.orders-scroll-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: calc(100vh - 258px);
}
.orders-scroll-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 12px;
}
.orders-scroll-wrapper::-webkit-scrollbar-track {
    background: #e2e8f0;
}
.orders-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 6px;
}
.orders-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}
.orders-scroll-wrapper::-webkit-scrollbar-corner {
    background: #e2e8f0;
}
.orders-table {
    width: 100%;
    min-width: 2200px;
    border-collapse: separate;
    border-spacing: 0;
}
.orders-table th,
.orders-table td {
    white-space: nowrap;
}
.orders-table thead tr {
    position: sticky;
    top: 0;
    z-index: 15;
}
.orders-table thead tr:first-child th {
    background-color: #f9fafb;
}
.orders-table thead tr:nth-child(2) th {
    background-color: #ffffff;
}
.orders-table th:nth-child(1),
.orders-table td:nth-child(1) { width: 70px; min-width: 70px; }
.orders-table .col-status { min-width: 160px; }
.orders-table .col-number { min-width: 160px; }
.orders-table .col-type { min-width: 100px; }
.orders-table .col-name { min-width: 240px; }
.orders-table .col-client { min-width: 200px; }
.orders-table .col-priority { min-width: 120px; }
.orders-table .col-date { min-width: 180px; }
.orders-table .col-user { min-width: 160px; }
.orders-table .col-progress { min-width: 150px; }
.orders-table .col-deadline { min-width: 180px; }
.orders-table .col-worktime { min-width: 160px; }
.orders-table .col-actions { width: 70px; min-width: 70px; }

/* Sticky actions column - header (sticky both directions: right + top via thead) */
.sticky-action-header {
    position: sticky !important;
    right: 0 !important;
    z-index: 25;
    background-color: #f9fafb !important;
    border-left: 2px solid #e5e7eb;
}

/* Sticky actions column - filter row (sticky both directions: right + top via thead) */
.sticky-action-filter {
    position: sticky !important;
    right: 0 !important;
    z-index: 25;
    background-color: #ffffff !important;
    border-left: 2px solid #e5e7eb;
}

/* Sticky actions column - data rows (sticky right only) */
.sticky-action-cell {
    position: sticky !important;
    right: 0 !important;
    z-index: 10;
    border-left: 2px solid #e5e7eb;
    padding: 0.75rem;
}

/* Hover row highlight for sticky cell */
tr:hover .sticky-action-cell {
    background-color: #f3f4f6 !important;
}
