/* Custom CSS for LyfeLockr */

/* Smooth transitions and animations */
* {
    transition: all 0.2s ease-in-out;
}

/* Modern dropdown styling */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Enhanced dropdown styling to match the design */
select {
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease-in-out;
}

select:hover {
    border-color: #9ca3af;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Dropdown option styling */
select option {
    background-color: white;
    color: #111827;
    padding: 12px 16px;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

select option:hover {
    background-color: #f3f4f6;
}

select option:checked {
    background-color: #eff6ff;
    color: #1e40af;
}

/* Custom dropdown arrow */
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px 16px;
    padding-right: 40px;
}

/* Navigation button styling */
#recordsTab, #granteesTab, #logoutBtn {
    font-family: 'Pacaembu', sans-serif;
    font-weight: 300;
}

/* Remove arrows from number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

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

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

/* Simple toast styling - no blocking issues */

/* Enhanced dropdown appearance */
select {
    font-size: 14px;
    line-height: 1.4;
}

/* Dropdown option separators and spacing */
select option {
    margin: 0;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
    padding: 8px 12px;
}

select option:last-child {
    border-bottom: none;
}

/* Dropdown focus and active states */
select:focus option:checked {
    background: linear-gradient(0deg, #eff6ff 0%, #eff6ff 100%);
    color: #1e40af;
    font-weight: 500;
}

/* Ensure consistent dropdown sizing */
select[size] {
    min-height: auto;
}

/* Modal animations */
.modal {
    transition: opacity 0.3s ease-in-out;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

/* Step content animations */
.step-content {
    animation: fadeInUp 0.5s ease-out;
}

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

/* File upload styling */
#idUpload {
    transition: all 0.3s ease;
}

#idUpload:hover {
    border-color: #2563eb;
    background-color: #f8fafc;
}

#idUpload.dragover {
    border-color: #2563eb;
    background-color: #eff6ff;
    transform: scale(1.02);
}

/* Asset and grantee cards */
.asset-card, .grantee-card {
    transition: all 0.2s ease;
}

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

/* Progress bar animation */
#progressBar {
    transition: width 0.5s ease-in-out;
}

/* Button hover effects */
button {
    transition: all 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* Form input focus effects */
input:focus, select:focus {
    transform: scale(1.01);
}

/* Toast notifications */
.toast {
    animation: slideInRight 0.3s ease-out;
}

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

@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;
    }
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

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

/* Responsive design improvements */
@media (max-width: 768px) {
    /* Fix mobile viewport and whitespace issues */
    body {
        overflow-x: hidden;
    }
    
    /* Ensure main containers don't have excessive spacing */
    #welcomeScreen,
    #signInScreen,
    #loginOtpScreen,
    #signupFlow,
    #accountReady,
    #dashboard {
        min-height: 100vh;
        overflow-x: hidden;
    }
    
    /* Dashboard specific container fixes - more gentle approach */
    #dashboard .max-w-7xl {
        padding-bottom: 2rem;
    }
    
    /* Reduce mobile navbar white space */
    #dashboard nav {
        padding-bottom: 0.5rem;
    }
    
    #dashboard nav .max-w-7xl {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .step-content {
        padding-top: 6rem;
        padding-bottom: 2rem;
    }
    
    .modal .relative {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    /* Mobile filter active states - ensure they work on mobile */
    #mobileFiltersContainer .record-type-filter.active,
    #toggleFilters.active {
        background-color: #635BFF10 !important;
        color: #635BFF !important;
        border-color: #635BFF !important;
        font-weight: 500 !important;
    }
    
    /* Ensure mobile filter buttons have proper active styling - override JS-applied classes */
    #mobileFiltersContainer .record-type-filter.active.bg-stripe-purple,
    #mobileFiltersContainer .record-type-filter.active.bg-gray-50,
    #toggleFilters.active.bg-stripe-purple,
    #toggleFilters.active.bg-gray-50 {
        background-color: #635BFF10 !important;
        color: #635BFF !important;
        border-color: #635BFF !important;
    }
    
    /* Override any combination of classes that JS might apply */
    #mobileFiltersContainer .record-type-filter.active,
    #mobileFiltersContainer .record-type-filter.active.text-white,
    #mobileFiltersContainer .record-type-filter.active.text-gray-700,
    #toggleFilters.active,
    #toggleFilters.active.text-white,
    #toggleFilters.active.text-gray-700 {
        background-color: #635BFF10 !important;
        color: #635BFF !important;
        border-color: #635BFF !important;
    }
    
    /* Gentle padding adjustments for mobile */
    .py-16 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    .py-12 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    .py-8 {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    /* Specific fix for dashboard content container */
    #dashboard .py-8 {
        padding-bottom: 1rem;
    }
    
    /* Gentle spacing adjustments for record cards */
    .record-card {
        margin-bottom: 1rem;
        padding-bottom: 1rem !important; /* Reduce bottom padding */
    }
    
    /* Fix tag wrapping issues */
    .record-card .inline-flex {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        flex-shrink: 0;
    }
    
    /* Ensure sharing status tags don't wrap */
    .record-card .bg-stripe-purple\/10,
    .record-card .bg-green-100,
    .record-card .bg-gray-100 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
        display: inline-flex;
        align-items: center;
    }
    
    /* Responsive tag sizing for mobile */
    @media (max-width: 640px) {
        .record-card .inline-flex {
            font-size: 0.75rem;
            padding: 0.25rem 0.5rem;
        }
        
        .record-card .bg-stripe-purple\/10,
        .record-card .bg-green-100,
        .record-card .bg-gray-100 {
            font-size: 0.75rem;
            padding: 0.25rem 0.5rem;
        }
        
        /* Hide secondary tag on mobile when primary tag is too long */
        .mobile-hidden {
            display: none !important;
        }
    }
    
    /* Ensure secondary tag is visible on desktop */
    @media (min-width: 768px) {
        .mobile-hidden {
            display: inline-flex !important;
        }
    }
    
    /* Reduce excessive bottom margins on last elements */
    #dashboard .bg-white.rounded-2xl:last-child {
        margin-bottom: 1rem;
    }
}

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

/* Focus indicators for keyboard navigation */
button:focus, input:focus, select:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-gray-50 {
        background-color: #ffffff;
    }
    
    .text-gray-600 {
        color: #000000;
    }
    
    .border-gray-200 {
        border-color: #000000;
    }
}

/* Print styles */
@media print {
    .modal, .toast, button {
        display: none !important;
    }
}

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

/* Blinking animation for pending invitation cards */
.blink-pending {
    animation: blink-attention 2s ease-in-out 3;
    animation-delay: 0.5s;
}

@keyframes blink-attention {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.3), 0 10px 10px -5px rgba(59, 130, 246, 0.2);
    }
}

.blink-pending .status-badge {
    animation: pulse-badge 2s ease-in-out 3;
    animation-delay: 0.5s;
}

@keyframes pulse-badge {
    0%, 100% {
        background-color: #fbbf24;
    }
    50% {
        background-color: #f59e0b;
        transform: scale(1.1);
    }
}

.skeleton-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.skeleton-line {
    height: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 0.75rem;
}

.skeleton-line.w-3-4 {
    width: 75%;
}

.skeleton-line.w-1-2 {
    width: 50%;
}

.skeleton-line.w-1-4 {
    width: 25%;
}

.skeleton-button {
    height: 2.5rem;
    border-radius: 0.5rem;
    width: 8rem;
}
