/* ================================================
   JIVDAYA TRUST MANAGEMENT PORTAL - STYLES
   ================================================ */

/* Base Styles */
* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

html, body { 
    margin: 0; 
    padding: 0; 
    overflow-x: hidden; 
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: #f1f5f9; 
    touch-action: manipulation;
}

/* Loading */
.loading { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(255,255,255,0.95); 
    display: flex; 
    align-items: center; 
    justify-center; 
    z-index: 9999; 
}

.loader { 
    border: 4px solid #f1f5f9; 
    border-top: 4px solid #f97316; 
    border-radius: 50%; 
    width: 40px; 
    height: 40px; 
    animation: spin 1s linear infinite; 
}

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

/* Memorial Card Styles */
.memorial-outer-border { 
    border: 2px solid #a16207; 
    padding: 4px; 
    height: 100%; 
}

.memorial-inner-border { 
    border: 6px double #a16207; 
    position: relative; 
    height: 100%; 
    background: #fff; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: space-between; 
}

.flower-svg { 
    position: absolute; 
    width: 100px; 
    height: 100px; 
    z-index: 50; 
    pointer-events: none; 
    opacity: 0.8; 
}

.flower-tl { top: -10px; left: -10px; }
.flower-tr { top: -10px; right: -10px; transform: scaleX(-1); }
.flower-bl { bottom: 45px; left: -10px; transform: scaleY(-1); }
.flower-br { bottom: 45px; right: -10px; transform: scale(-1); }

.maroon-pattern {
    background-color: #800000;
    background-image: radial-gradient(circle at 2px 2px, rgba(255,255,255,0.1) 1px, transparent 0);
    background-size: 10px 10px;
}

.hindi-bold { 
    font-family: 'Noto Sans Devanagari', sans-serif; 
    font-weight: 900; 
}

.hindi-medium {
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-weight: 500;
}

.font-hindi, .hindi-bold, .hindi-medium { 
    letter-spacing: normal !important; 
    text-transform: none !important; 
}

/* Animations */
@keyframes fadeIn { 
    from { opacity: 0; transform: translateY(10px); } 
    to { opacity: 1; transform: translateY(0); } 
}

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

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animated-gradient {
    background: linear-gradient(-45deg, #f97316, #ea580c, #4c1d0f, #f97316);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Message Box */
#msg-box { 
    display: none; 
    position: fixed; 
    bottom: 80px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 10000; 
    max-width: 90vw;
    white-space: nowrap;
}

/* Form Elements - Mobile Optimized */
input[type="text"], 
input[type="number"], 
input[type="tel"], 
input[type="date"], 
input[type="password"], 
select, 
textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]:focus, 
input[type="number"]:focus, 
input[type="tel"]:focus, 
input[type="date"]:focus, 
input[type="password"]:focus, 
select:focus {
    border-color: #f97316 !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1) !important;
    outline: none;
}

button { 
    transition: all 0.2s ease; 
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button:active { transform: scale(0.96); }

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* Preview Scaling */
.preview-scale-container { 
    width: 100%; 
    display: flex; 
    justify-content: center; 
    padding: 10px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#receipt-wrapper, #social-card-wrapper { position: relative; }

/* Print Styles */
@media print {
    @page { size: A4 portrait; margin: 0; padding: 0; }
    #login-page, nav, #mobile-menu, #msg-box, .no-print, .lg\:col-span-4, .flex.justify-center, #view-history, #view-settings, #view-dashboard, .tab-content:not(#view-create) { 
        display: none !important; 
    }
    #main-app, main, #view-create, .lg\:col-span-8, .preview-scale-container, #receipt-wrapper, #social-card-wrapper { 
        display: block !important; 
        visibility: visible !important; 
        opacity: 1 !important; 
        margin: 0 !important; 
        padding: 0 !important; 
        width: 100% !important; 
        max-width: none !important; 
        position: static !important; 
    }
    #receipt-wrapper.hidden, #social-card-wrapper.hidden { display: none !important; }
    body { 
        background: white !important; 
        margin: 0 !important; 
        padding: 0 !important; 
        -webkit-print-color-adjust: exact; 
        print-color-adjust: exact; 
    }
    #receipt-container { 
        box-shadow: none !important; 
        border: none !important; 
        transform: scale(1) !important; 
        width: 100% !important; 
        height: 297mm !important; 
        margin: 0 !important; 
        padding: 0 !important; 
    }
    #social-card { 
        transform: scale(1) !important; 
        width: 100% !important; 
        height: 297mm !important; 
        margin: 0 !important; 
    }
}

/* ============================================
   MOBILE RESPONSIVE STYLES - ENHANCED
   ============================================ */

/* Base Mobile - All Devices */
@media screen and (max-width: 1024px) {
    body { 
        font-size: 14px; 
        padding-bottom: 85px;
    }
    
    #receipt-container { 
        transform: scale(0.7); 
        transform-origin: top center; 
        margin-bottom: -300px; 
    }
    
    #social-card { 
        transform: scale(0.65); 
        transform-origin: top center; 
        margin-bottom: -140px; 
    }
}

/* Tablet & Small Desktop */
@media screen and (max-width: 768px) {
    body { padding-bottom: 90px; }
    
    nav #desktop-nav-container { display: none !important; }
    
    main { 
        padding: 1rem !important; 
        padding-bottom: 100px !important;
    }
    
    .max-w-7xl { 
        margin: 0 !important; 
        padding: 0 !important; 
    }
    
    input, select, textarea { 
        min-height: 48px !important; 
        font-size: 16px !important; 
        padding: 0.75rem !important;
        border-radius: 0.75rem !important;
    }
    
    button { 
        min-height: 48px !important;
        padding: 0.75rem 1rem !important; 
        font-size: 13px !important; 
        border-radius: 0.75rem !important;
    }
    
    .grid.lg\\:grid-cols-12 { 
        grid-template-columns: 1fr !important; 
        gap: 1rem !important;
    }
    
    .lg\\:col-span-4, .lg\\:col-span-8 { 
        width: 100% !important; 
    }
    
    .lg\\:sticky { 
        position: static !important; 
    }
    
    .p-8, .p-10 { padding: 1.25rem !important; }
    .p-6 { padding: 1rem !important; }
    .p-5 { padding: 0.875rem !important; }
    
    .gap-6, .gap-8 { gap: 1rem !important; }
    .space-y-6 > * + *, .space-y-8 > * + * { margin-top: 1rem !important; }
    
    .text-4xl { font-size: 1.875rem !important; line-height: 1.2 !important; }
    .text-3xl { font-size: 1.5rem !important; line-height: 1.2 !important; }
    .text-2xl { font-size: 1.25rem !important; }
    .text-xl { font-size: 1.125rem !important; }
    
    .rounded-3xl { border-radius: 1.25rem !important; }
    .rounded-2xl { border-radius: 1rem !important; }
    
    .mobile-stats-grid { 
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 0.875rem !important; 
    }
    
    .mobile-stats-full { grid-column: span 2 !important; }
    
    .overflow-x-auto { 
        overflow-x: auto !important; 
        -webkit-overflow-scrolling: touch !important; 
    }
    
    table { font-size: 12px !important; }
    table th, table td { 
        padding: 0.625rem !important; 
        white-space: nowrap;
    }
    
    #receipt-container { 
        transform: scale(0.55); 
        transform-origin: top center; 
        margin-bottom: -450px; 
    }
    
    #social-card { 
        transform: scale(0.5); 
        transform-origin: top center; 
        margin-bottom: -200px; 
    }
}

/* Large Phones */
@media screen and (max-width: 640px) {
    body { padding-bottom: 95px; font-size: 13px; }
    
    main { 
        padding: 0.875rem !important; 
        padding-bottom: 110px !important; 
    }
    
    input, select, textarea {
        font-size: 16px !important;
        padding: 0.65rem !important;
        min-height: 46px !important;
    }
    
    button {
        font-size: 12px !important;
        min-height: 44px !important;
        padding: 0.625rem 0.875rem !important;
    }
    
    .text-4xl { font-size: 1.625rem !important; }
    .text-3xl { font-size: 1.375rem !important; }
    .text-2xl { font-size: 1.125rem !important; }
    .text-xl { font-size: 1rem !important; }
    
    .p-8, .p-10 { padding: 1rem !important; }
    .p-6 { padding: 0.875rem !important; }
    .px-10, .px-8, .px-6 { 
        padding-left: 0.875rem !important; 
        padding-right: 0.875rem !important; 
    }
    
    .gap-6, .gap-8 { gap: 0.875rem !important; }
    .space-y-6 > * + *, .space-y-8 > * + * { margin-top: 0.875rem !important; }
    
    .rounded-3xl { border-radius: 1rem !important; }
    .rounded-2xl { border-radius: 0.875rem !important; }
    
    table { font-size: 11px !important; }
    table th, table td { padding: 0.5rem !important; }
    
    #receipt-container { 
        transform: scale(0.45); 
        transform-origin: top center; 
        margin-bottom: -550px; 
    }
    
    #social-card { 
        transform: scale(0.42); 
        transform-origin: top center; 
        margin-bottom: -280px; 
    }
}

/* Standard Phones */
@media screen and (max-width: 480px) {
    body { padding-bottom: 100px; font-size: 13px; }
    
    main { 
        padding: 0.75rem !important; 
        padding-bottom: 120px !important; 
    }
    
    input, select, textarea {
        font-size: 16px !important;
        padding: 0.625rem !important;
        min-height: 44px !important;
        margin-bottom: 0.5rem;
    }
    
    button {
        font-size: 11px !important;
        min-height: 42px !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    .text-4xl { font-size: 1.5rem !important; }
    .text-3xl { font-size: 1.25rem !important; }
    .text-2xl { font-size: 1.125rem !important; }
    .text-xl { font-size: 1rem !important; }
    .text-lg { font-size: 0.9375rem !important; }
    
    .p-8, .p-10 { padding: 0.875rem !important; }
    .p-6 { padding: 0.75rem !important; }
    .p-5 { padding: 0.625rem !important; }
    
    .px-10, .px-8, .px-6, .px-5 { 
        padding-left: 0.75rem !important; 
        padding-right: 0.75rem !important; 
    }
    
    .gap-6, .gap-8, .gap-10 { gap: 0.75rem !important; }
    .space-y-6 > * + *, .space-y-8 > * + * { margin-top: 0.75rem !important; }
    
    .rounded-3xl { border-radius: 0.875rem !important; }
    .rounded-2xl { border-radius: 0.75rem !important; }
    .rounded-xl { border-radius: 0.625rem !important; }
    
    table { font-size: 10px !important; }
    table th, table td { padding: 0.375rem !important; }
    
    .mobile-stats-grid { gap: 0.75rem !important; }
    
    .glass-effect { padding: 2rem !important; }
    
    #receipt-container { 
        transform: scale(0.38); 
        transform-origin: top center; 
        margin-bottom: -620px; 
    }
    
    #social-card { 
        transform: scale(0.35); 
        transform-origin: top center; 
        margin-bottom: -340px; 
    }
}

/* Small Phones */
@media screen and (max-width: 375px) {
    body { padding-bottom: 105px; }
    
    main { 
        padding: 0.625rem !important; 
        padding-bottom: 125px !important; 
    }
    
    input, select, textarea {
        padding: 0.5rem !important;
        min-height: 42px !important;
    }
    
    button {
        font-size: 10px !important;
        min-height: 40px !important;
        padding: 0.5rem !important;
    }
    
    .text-4xl { font-size: 1.375rem !important; }
    .text-3xl { font-size: 1.125rem !important; }
    .text-2xl { font-size: 1rem !important; }
    
    .p-8, .p-10 { padding: 0.75rem !important; }
    .p-6 { padding: 0.625rem !important; }
    
    table { font-size: 9px !important; }
    table th, table td { padding: 0.3125rem !important; }
    
    #receipt-container { 
        transform: scale(0.32); 
        transform-origin: top center; 
        margin-bottom: -680px; 
    }
    
    #social-card { 
        transform: scale(0.3); 
        transform-origin: top center; 
        margin-bottom: -380px; 
    }
}

/* Extra Small Phones */
@media screen and (max-width: 360px) {
    body { padding-bottom: 110px; font-size: 12px; }
    
    main { 
        padding: 0.5rem !important; 
        padding-bottom: 130px !important; 
    }
    
    #mobile-menu { 
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.25rem !important;
        padding: 0.625rem !important;
    }
    
    #mobile-menu button {
        font-size: 9px !important;
        padding: 0.5rem 0.25rem !important;
    }
    
    .text-4xl { font-size: 1.25rem !important; }
    .text-3xl { font-size: 1.125rem !important; }
    .text-2xl { font-size: 1rem !important; }
    
    #receipt-container { 
        transform: scale(0.28); 
        transform-origin: top center; 
        margin-bottom: -720px; 
    }
    
    #social-card { 
        transform: scale(0.26); 
        transform-origin: top center; 
        margin-bottom: -420px; 
    }
}

/* Landscape Mode */
@media screen and (max-height: 500px) and (orientation: landscape) {
    body { padding-bottom: 70px; }
    main { padding-bottom: 80px !important; }
    #mobile-menu { padding: 0.5rem !important; }
    #msg-box { bottom: 60px; }
}

/* Safe Area for Notched Devices */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: calc(85px + env(safe-area-inset-bottom));
    }
    #mobile-menu {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }
    #msg-box {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }
}
