/* PROMPTIX PAY - Apple-Inspired Minimalist Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@500;700&family=Dancing+Script:wght@600&display=swap');

:root {
    --primary: #0071E3; /* Apple Blue */
    --primary-hover: #0077ED;
    --bg-main: #FFFFFF;
    --bg-secondary: #FBFBFD; /* Apple Light Gray */
    --text-main: #1D1D1F; /* Apple Black */
    --text-muted: #86868B; /* Apple Gray */
    --border: #D2D2D7;
    --border-light: #E5E5E7;
    --radius: 12px;
    --shadow-minimal: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Luxury Fintech Branding */
.brand-promptix {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.05em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-main);
}

.brand-pay {
    font-family: 'Dancing Script', cursive;
    background: linear-gradient(135deg, #4F46E5 0%, #9333EA 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-style: italic;
    font-size: 1.2em;
    margin-left: 2px;
    font-weight: 600;
}

/* Signature Bold Premium Branding */
.branding-main {
    height: 110px !important;
    max-height: 110px !important;
    width: auto !important;
    object-fit: contain !important;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.05));
}

.branding-sidebar {
    height: 110px !important;
    max-height: 110px !important;
    width: auto !important;
    object-fit: contain !important;
}

.branding-footer {
    height: 120px !important;
    max-height: 120px !important;
    width: auto !important;
    object-fit: contain !important;
}

@media (max-width: 768px) {
    .branding-main {
        height: 85px !important;
        max-height: 85px !important;
    }
}

.logo-startup {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
}

.logo-startup:hover {
    transform: translateY(-3px) scale(1.08) rotate(2deg);
}

/* Apple-Style Buttons */
.btn-premium {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-premium:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-premium:active {
    transform: scale(0.98);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-light);
    color: var(--primary);
    border-radius: 20px;
    transition: all 0.2s ease;
    padding: 8px 20px;
    cursor: pointer;
    font-weight: 500;
}

.btn-secondary:hover {
    background-color: #F5F5F7;
    border-color: var(--border);
}

/* Apple Cards */
.card-premium {
    background: var(--bg-main);
    border-radius: 20px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-minimal);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-premium:hover {
    box-shadow: var(--shadow-soft);
    border-color: var(--border);
}

/* Apple Glass (Frosted) */
.glass {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Apple Sidebar */
.sidebar-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 16px !important;
    border-radius: 10px !important;
    font-weight: 400;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
}

.sidebar-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
}

.sidebar-item.active {
    color: var(--text-main) !important;
    background-color: var(--bg-secondary) !important;
    font-weight: 600;
}

.sidebar-item:not(.active) {
    color: var(--text-muted) !important;
}

.sidebar-item:not(.active):hover {
    background-color: #F5F5F7 !important;
    color: var(--text-main) !important;
}

/* Inputs */
.input-premium {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background-color: var(--bg-secondary);
    outline: none;
    transition: all 0.2s ease;
    font-size: 15px;
    box-sizing: border-box;
}

.input-premium:focus {
    border-color: var(--primary);
    background-color: var(--bg-main);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

/* Tables */
.table-header {
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
}

.status-badge {
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
}

.animate-fade-in {
    animation: appleFade 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Premium Apple Toast Notification System */
.toast-notification {
    position: fixed;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 14px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 9999;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    max-width: 320px;
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon-box {
    width: 22px;
    height: 22px;
    background: #0071E3;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.toast-content {
    font-size: 13px;
    font-weight: 600;
    color: #1D1D1F;
    line-height: 1.4;
}

/* Custom Apple Alert Modal System */
.apple-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.apple-alert-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.apple-alert {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(30px);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    width: 270px;
    border-radius: 14px;
    padding: 20px 0 0 0;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
    transition: transform 0.3s cubic-bezier(0.2, 1, 0.2, 1);
    overflow: hidden;
}

.apple-alert-overlay.show .apple-alert {
    transform: scale(1);
}

.apple-alert-title {
    font-size: 17px;
    font-weight: 700;
    color: #1D1D1F;
    margin-bottom: 2px;
    padding: 0 20px;
}

.apple-alert-body {
    font-size: 13px;
    color: #1D1D1F;
    margin-bottom: 20px;
    line-height: 1.4;
    padding: 0 20px;
}

.apple-alert-buttons {
    display: flex;
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
}

.apple-alert-btn {
    flex: 1;
    padding: 12px;
    font-size: 17px;
    font-weight: 400;
    color: #0071E3;
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

.apple-alert-btn:first-child {
    border-right: 0.5px solid rgba(0, 0, 0, 0.1);
}

.apple-alert-btn.destructive {
    color: #FF3B30;
    font-weight: 600;
}

.apple-alert-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

/* --- RESPONSIVE CORE & UTILITIES --- */
@media (max-width: 1024px) {
    aside {
        position: fixed !important;
        left: -260px !important;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        width: 260px !important;
        box-shadow: 20px 0 50px rgba(0,0,0,0.1);
    }
    
    aside.active {
        transform: translateX(260px);
    }

    main {
        padding-left: 0 !important;
    }
}

/* Fluid Spacing & Typography */
@media (max-width: 480px) {
    .text-4xl {
        font-size: 1.75rem !important;
    }
    nav a.text-xl {
        font-size: 17px !important;
        letter-spacing: -0.01em;
    }
    nav .px-6 {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

@media (max-width: 768px) {
    .pt-40 {
        padding-top: 80px !important;
    }
    .pb-20 {
        padding-bottom: 40px !important;
    }
    .p-10 {
        padding: 24px !important;
    }
    
    .px-10 {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }

    .text-4xl {
        font-size: 2.25rem !important;
    }
    
    .btn-premium, .btn-secondary {
        width: 100%;
        margin-bottom: 12px;
        min-height: 48px; /* Optimal touch target */
        font-size: 15px !important;
        padding: 12px 24px !important;
    }

    .input-premium {
        min-height: 48px;
        font-size: 16px !important; /* Prevents auto-zoom on iOS */
    }

    /* Locked Header Alignment on Mobile */
    header {
        height: 64px !important; /* Fixed height for consistency */
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }

    header .flex.items-center {
        justify-content: flex-start !important;
    }

    header .btn-premium {
        width: auto !important;
        margin-bottom: 0;
        padding: 8px 16px !important;
        min-height: 38px;
        font-size: 13px !important;
    }

    /* Audit Log Mobile Layout Optimization (6-Row Stack) */
    header.audit-header {
        height: auto !important;
        flex-direction: column !important;
        padding: 24px 20px !important;
        gap: 20px !important;
        align-items: center !important;
    }

    header.audit-header .flex.items-center:first-child {
        width: 100%;
        justify-content: flex-start !important;
    }

    header.audit-header .audit-filter {
        width: 100%;
        flex-direction: column !important;
        gap: 16px !important;
        align-items: center !important;
        padding-bottom: 8px !important;
    }

    header.audit-header .export-wrapper,
    header.audit-header .status-wrapper,
    header.audit-header .date-filter-wrapper {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    header.audit-header .export-wrapper button,
    header.audit-header #status-filter {
        width: 100% !important;
        max-width: 240px !important;
        height: 44px !important;
        margin: 0 auto !important;
        justify-content: center !important;
    }

    header.audit-header .date-range-capsule {
        width: 100% !important;
        max-width: 240px !important;
        flex-direction: column !important;
        padding: 16px !important;
        border-radius: 16px !important;
        gap: 12px !important;
    }

    header.audit-header .date-range-capsule .h-4.w-\[1px\] {
        display: none !important;
    }

    header.audit-header .date-range-capsule .flex.items-center {
        width: 100% !important;
        justify-content: space-between !important;
    }

    header.audit-header .date-range-capsule input {
        width: 150px !important;
        text-align: right !important;
        font-size: 13px !important;
    }

    header.audit-header .date-actions {
        width: 100% !important;
        max-width: 240px !important;
        justify-content: center !important;
        gap: 12px !important;
    }

    header.audit-header .date-actions button {
        flex: 1 !important;
        height: 50px !important;
        font-size: 13px !important;
    }

    .audit-title {
        font-size: 18px !important;
        letter-spacing: -0.01em !important;
    }

    header.audit-header .filter-label {
        display: none !important;
    }

    /* Stack buttons in modals/forms on mobile - targeted at buttons */
    .flex.space-x-6 > .btn-premium, 
    .flex.space-x-6 > .btn-secondary,
    .flex.space-x-4 > .btn-premium, 
    .flex.space-x-4 > .btn-secondary,
    .flex.space-x-3 > .btn-premium,
    .flex.space-x-3 > .btn-secondary {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .flex.space-x-6:has(> .btn-premium),
    .flex.space-x-4:has(> .btn-premium), 
    .flex.space-x-3:has(> .btn-premium) {
        flex-direction: column !important;
        gap: 12px !important;
    }

    /* Fluid Typography Scaling */
    .text-6xl, h1.text-6xl {
        font-size: 2.5rem !important; /* Elegant mobile sizing */
        line-height: 1.1 !important;
        letter-spacing: -0.02em !important;
    }
    
    .text-7xl, h1.text-7xl {
        font-size: 2.75rem !important;
        line-height: 1.1 !important;
    }

    /* Navbar Clean-up */
    nav .px-6 {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    /* Section Tightening */
    .pt-40 {
        padding-top: 100px !important;
    }
    .pb-20 {
        padding-bottom: 40px !important;
    }
    .py-32 {
        padding-top: 60px !important;
        padding-bottom: 60px !important;
    }

    /* Maintain desktop-like feel for small badges and icons */
    .status-badge {
        width: auto !important;
        margin-bottom: 0;
    }
}

/* Responsive Grid Utility */
.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

/* Table Responsiveness */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .table-header {
        display: none;
    }
    
    tr {
        display: block;
        position: relative;
        padding: 24px;
        background: #111827 !important; /* Deep Slate Dark */
        border-radius: 32px;
        border: 1px solid rgba(255, 255, 255, 0.05);
        margin-bottom: 20px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
        transition: all 0.3s ease;
    }
    
    tr:hover {
        background: #1F2937 !important;
        transform: translateY(-2px);
    }
    
    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 0 !important;
        border: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
        min-height: 44px;
    }

    td:last-child {
        border-bottom: none !important;
        padding-bottom: 0 !important;
        margin-top: 8px;
    }
    
    td::before {
        content: attr(data-label);
        font-size: 9px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.12em;
        color: #64748B; /* Muted Blue Slate */
        text-align: left;
        flex-shrink: 0;
    }

    /* Target values and their children (Excluding Badges) */
    td > div, td > span:not(.status-badge), td > button, td > a,
    td div, td span:not(.status-badge) {
        text-align: right !important;
        align-items: flex-end !important;
        color: #F8FAFC !important;
        font-weight: 600;
    }

    /* Name Styling */
    td[data-label="Name"] div:first-child {
        font-size: 16px !important;
        font-weight: 800 !important;
        letter-spacing: -0.01em;
        color: #FFFFFF !important;
    }

    /* ID Positioning - Floating */
    .mobile-id {
        position: absolute;
        top: 24px;
        right: 24px;
        font-size: 8px !important;
        font-weight: 900 !important;
        color: rgba(255, 255, 255, 0.2) !important;
        text-transform: uppercase;
        letter-spacing: 0.1em;
    }

    /* Status Badge Refinement */
    .status-badge {
        padding: 4px 14px !important;
        border-radius: 20px !important;
        font-size: 10px !important;
        font-weight: 800 !important;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Specific Mobile Badge Overrides */
    .badge-group-mobile {
        background: #F8FAFC !important; /* Soft White */
        color: #1E293B !important; /* Dark Slate */
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
    }

    .badge-paid-mobile {
        background: #22C55E !important; /* Vibrant Green */
        color: #FFFFFF !important; /* White Text */
        box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
    }

    .badge-pending-mobile {
        background: #F59E0B !important; /* Vibrant Amber */
        color: #FFFFFF !important;
    }

    /* Button Resize - Shrunk for Mobile */
    .mobile-action-btn {
        padding: 6px 12px !important;
        font-size: 10px !important;
        border-radius: 12px !important;
        height: auto !important;
        width: auto !important;
        min-width: auto !important;
        justify-content: center !important;
    }
}

.logo-blend {
    mix-blend-mode: multiply;
}

/* Sidebar Toggle Animation */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.1);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}
