/* Custom Styles for Hostelo */

/* Smooth transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-duration: 200ms;
}

/* Active navigation item */
.nav-item.active {
    background: linear-gradient(135deg, #4F46E5 0%, #06B6D4 100%);
    color: white;
}

.nav-item.active svg {
    color: white;
}

/* Sidebar transitions */
#sidebar {
    transform: translateX(0);
}

#sidebar.hidden-mobile {
    transform: translateX(-100%);
}

@media (max-width: 1024px) {
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(-100%);
    }
    
    #sidebar.show-mobile {
        transform: translateX(0);
    }
}

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

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

/* Quick action buttons */
.quick-action-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.quick-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quick-action-btn:hover::before {
    opacity: 1;
}

.quick-action-btn:active {
    transform: translateY(-2px) scale(0.98);
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4B5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

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

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

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

.toast.removing {
    animation: slideOutRight 0.3s ease-in;
}

/* Loading spinner */
.spinner {
    border: 3px solid rgba(79, 70, 229, 0.1);
    border-top-color: #4F46E5;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Button loading state */
.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Table styles */
.table-container {
    overflow-x: auto;
}

.table-container table {
    min-width: 100%;
}

/* Form validation */
input:invalid:focus,
textarea:invalid:focus,
select:invalid:focus {
    border-color: #EF4444;
    --tw-ring-color: #EF4444;
}

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

/* Gradient backgrounds */
.gradient-primary {
    background: linear-gradient(135deg, #4F46E5 0%, #06B6D4 100%);
}

.gradient-success {
    background: linear-gradient(135deg, #10B981 0%, #06B6D4 100%);
}

.gradient-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .print-full-width {
        width: 100%;
    }
}

/* Modal backdrop */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success {
    background-color: #D1FAE5;
    color: #065F46;
}

.badge-danger {
    background-color: #FEE2E2;
    color: #991B1B;
}

.badge-warning {
    background-color: #FEF3C7;
    color: #92400E;
}

.badge-info {
    background-color: #DBEAFE;
    color: #1E40AF;
}

/* Dark mode badge styles */
.dark .badge-success {
    background-color: #065F46;
    color: #D1FAE5;
}

.dark .badge-danger {
    background-color: #991B1B;
    color: #FEE2E2;
}

.dark .badge-warning {
    background-color: #92400E;
    color: #FEF3C7;
}

.dark .badge-info {
    background-color: #1E40AF;
    color: #DBEAFE;
}

/* Menu card enhancements */
.menu-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.menu-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0.2));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-card:hover::before {
    opacity: 1;
}

.menu-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.menu-card:active {
    transform: translateY(-2px) scale(1.01);
}

.menu-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(30%);
}

.menu-card.disabled:hover {
    transform: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.5rem;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

/* Bounce animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.bounce {
    animation: bounce 1s infinite;
}

/* Enhanced input focus */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

.table-hover tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.05);
    transform: scale(1.005);
}

.dark .table-hover tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

/* Smooth nav item transitions */
.nav-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
    transform: translateX(4px);
}

/* Button primary styles */
.btn-primary {
    background: linear-gradient(135deg, #4F46E5 0%, #06B6D4 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Empty state */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

/* Notification dot */
.notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: #EF4444;
    border-radius: 50%;
    border: 2px solid white;
}

.dark .notification-dot {
    border-color: #1F2937;
}

/* Floating action button */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #4F46E5 0%, #06B6D4 100%);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 40;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(79, 70, 229, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

/* Progress bar */
.progress-bar {
    height: 0.5rem;
    background-color: #E5E7EB;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4F46E5 0%, #06B6D4 100%);
    transition: width 0.3s ease;
}

.dark .progress-bar {
    background-color: #374151;
}

/* ========================================
   RESPONSIVE DESIGN IMPROVEMENTS
   ======================================== */

/* Mobile devices (320px - 639px) */
@media (max-width: 639px) {
    /* Ensure minimum touch target size (44x44px) */
    button, 
    a.nav-item,
    .menu-card,
    .stat-card {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better spacing for mobile */
    #main-content {
        padding: 1rem !important;
    }
    
    /* Stack dashboard cards */
    .grid {
        gap: 0.75rem;
    }
    
    /* Full width on mobile */
    .modal-backdrop > div {
        width: 95%;
        max-width: 95%;
        margin: 0.5rem;
    }
    
    /* Better text sizes on mobile */
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    /* Improved table responsiveness */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-container table {
        min-width: 600px;
    }
    
    /* Better form inputs on mobile */
    input,
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Profile button improvements */
    #user-profile-btn {
        padding: 0.5rem;
    }
}

/* Tablet devices (640px - 1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
    /* Tablet-optimized grid layouts */
    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    /* Better spacing */
    #main-content {
        padding: 1.5rem !important;
    }
    
    /* Optimize modal size */
    .modal-backdrop > div {
        max-width: 600px;
    }
    
    /* Dashboard menu cards - 2 columns on tablet */
    .dashboard-menu-card {
        min-height: 120px;
    }
}

/* Laptop/Desktop (1024px+) */
@media (min-width: 1024px) {
    /* Optimal spacing for desktop */
    #main-content {
        padding: 2rem !important;
    }
    
    /* Better hover effects on desktop */
    .stat-card:hover,
    .menu-card:hover {
        transform: translateY(-6px) scale(1.03);
    }
    
    /* Profile button with better hover */
    #user-profile-btn:hover {
        background-color: rgba(79, 70, 229, 0.1);
    }
    
    .dark #user-profile-btn:hover {
        background-color: rgba(79, 70, 229, 0.2);
    }
}

/* Fix for landscape mobile */
@media (max-width: 1023px) and (orientation: landscape) {
    #sidebar {
        width: 200px;
    }
    
    #main-content {
        padding: 1rem;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders and shadows */
    .shadow-lg {
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.10);
    }
}

/* Touch-specific improvements */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .nav-item:hover {
        transform: none;
    }
    
    /* Increase tap target sizes */
    button,
    a {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
    
    /* Better active states for touch */
    button:active,
    a:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* Safe areas for notched devices */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
button:focus-visible,
a:focus-visible {
    outline: 2px solid #4F46E5;
    outline-offset: 2px;
}

/* Improved contrast for accessibility */
@media (prefers-contrast: high) {
    .text-gray-600 {
        color: #000000;
    }
    
    .dark .text-gray-400 {
        color: #FFFFFF;
    }
}
