/* Style tambahan untuk modal dialog */
dialog[open] {
    animation: fadeIn 0.3s ease-out;
}

dialog::backdrop {
    animation: backdropFadeIn 0.3s ease-out;
    background-color: rgba(0, 0, 0, 0.5);
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

@keyframes backdropFadeIn {
    from { 
        opacity: 0; 
    }
    to { 
        opacity: 1; 
    }
}

/* Sembunyikan panah di input number */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type='number'] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Loading spinner animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Smooth transitions */
.transition {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Table hover effect */
#asset-table tbody tr:hover {
    background-color: #f9fafb;
}

/* Button hover effects */
button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* Focus styles */
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Responsive adjustments - Mobile First Approach */
@media (max-width: 768px) {
    /* Container adjustments */
    .container {
        padding: 0.75rem;
    }
    
    /* Category tabs - horizontal scroll on mobile */
    #category-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* For older iOS */
        scrollbar-width: thin; /* Firefox */
        padding-bottom: 0.5rem;
    }
    
    #category-tabs::-webkit-scrollbar {
        height: 4px;
    }
    
    #category-tabs::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 2px;
    }
    
    .category-tab {
        white-space: nowrap;
        min-width: max-content; /* Better browser support */
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Table responsive - convert to card layout on mobile */
    #asset-table,
    #schedule-table,
    #issues-table {
        font-size: 0.75rem;
        display: block;
        width: 100%;
    }
    
    #asset-table thead,
    #schedule-table thead,
    #issues-table thead {
        display: none;
    }
    
    #asset-table tbody,
    #schedule-table tbody,
    #issues-table tbody {
        display: block;
        width: 100%;
    }
    
    #asset-table tbody tr,
    #schedule-table tbody tr,
    #issues-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 1rem;
        background: white;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    #asset-table tbody td,
    #schedule-table tbody td,
    #issues-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid #f3f4f6;
    }
    
    #asset-table tbody td:last-child,
    #schedule-table tbody td:last-child,
    #issues-table tbody td:last-child {
        border-bottom: none;
    }
    
    #asset-table tbody td::before,
    #schedule-table tbody td::before,
    #issues-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        text-transform: uppercase;
        font-size: 0.7rem;
        margin-right: 1rem;
        flex-shrink: 0;
    }
    
    /* Modal responsive */
    dialog {
        max-width: 95vw;
        margin: 1rem auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    dialog .p-6 {
        padding: 1rem;
    }
    
    /* Buttons - larger touch targets on mobile */
    button,
    .btn,
    a[class*="bg-"] {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Form inputs - larger on mobile */
    input[type="text"],
    input[type="date"],
    input[type="time"],
    input[type="number"],
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    /* Header adjustments */
    header h1 {
        font-size: 1.5rem;
    }
    
    header p {
        font-size: 0.75rem;
    }
    
    /* Stats cards - stack on mobile */
    .grid[class*="grid-cols"] {
        grid-template-columns: 1fr;
    }
    
    /* Navigation menu - wrap on mobile */
    nav.flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    nav a,
    nav button {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Action buttons container */
    .flex.flex-wrap {
        flex-direction: column;
        width: 100%;
    }
    
    .flex.flex-wrap > * {
        width: 100%;
    }
    
    /* Search input full width on mobile */
    #search-input {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Table action buttons - stack vertically on mobile */
    .flex.flex-col.sm\:flex-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .flex.flex-col.sm\:flex-row > * {
        width: 100%;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 1.5rem;
    }
    
    #asset-table,
    #schedule-table,
    #issues-table {
        font-size: 0.875rem;
    }
    
    #asset-table th,
    #asset-table td,
    #schedule-table th,
    #schedule-table td,
    #issues-table th,
    #issues-table td {
        padding: 0.75rem;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }
    
    header {
        padding: 1rem !important;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    header img {
        height: 3rem !important;
    }
    
    /* Make buttons even larger on very small screens */
    button,
    .btn,
    a[class*="bg-"] {
        min-height: 48px;
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
    }
    
    /* Stats cards - smaller padding */
    .stat-card,
    [class*="stat-card"] {
        padding: 1rem !important;
    }
    
    /* Modal - full screen on very small devices */
    dialog {
        max-width: 100vw;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
}

/* Print styles */
@media print {
    #add-asset-btn,
    #search-input,
    #asset-table td:last-child {
        display: none;
    }
    
    body {
        background: white;
    }
    
    .bg-white {
        box-shadow: none;
    }
}

