/* Global Floating Header Styles */
/* Import this in your pages: <link rel="stylesheet" href="{{ url_for('static', filename='css/floating-header.css') }}"> */

/* ========================================================================== */
/* GLOBAL SWEETALERT2 BUTTON THEMING                                          */
/* Lives here (not a Swal-specific file) because floating-header.css is the  */
/* one stylesheet loaded on every admin page. Individual pages set            */
/* Swal.fire({ confirmButtonColor: '#3085d6' / '#d33' / '#6b5acd' / ... })     */
/* inconsistently — dozens of different hardcoded hex values across the app,  */
/* none of them theme-aware. confirmButtonColor only sets a plain (non-       */
/* !important) inline style, so a stylesheet rule with !important reliably    */
/* overrides it for every Swal dialog app-wide without touching the ~300+     */
/* individual Swal.fire() call sites.                                        */
/* ========================================================================== */
.swal2-styled.swal2-confirm {
    background-color: var(--primary) !important;
    box-shadow: none !important;
}

.swal2-styled.swal2-confirm:hover {
    background-color: var(--primary-hover) !important;
}

.swal2-styled.swal2-confirm:focus {
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.3) !important;
}

.swal2-styled.swal2-cancel {
    background-color: var(--text-secondary, #64748b) !important;
}

.swal2-styled.swal2-deny {
    background-color: var(--error, #EF4444) !important;
}

/* Modern Fixed Header - Aligned with Sidebar */
/* Dark brand-color header, standardized app-wide (previously only applied
   via a page-local override on the Bank Guarantee page — now the shared
   default so every page is consistent). */
.floating-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 2000 !important;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-bottom: none;
    box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.28);
    animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    /* Remove transition on position to prevent shifting */
}

.floating-header:hover {
    box-shadow: 0 8px 32px rgba(var(--primary-rgb), 0.35);
}

.floating-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    max-width: 100%;
    margin: 0;
    height: 80px;
}

/* Brand Section */
.brand-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-container {
    position: relative;
}

.modern-logo {
    width: 52px;
    height: 52px;
    background: #FFFFFF;
    border: 2px solid var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
    padding: 6px;
}

.modern-logo:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.3);
    border-color: var(--primary-hover);
}

.modern-logo i {
    color: #FFFFFF;
    font-size: 26px;
}

.status-pulse {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #D97706, #F59E0B);
    border-radius: 50%;
    border: 3px solid #FFFFFF;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    box-shadow: 0 0 12px rgba(217, 119, 6, 0.5);
}

.brand-info h1,
.brand-title {
    font-family: var(--font-heading, 'Poppins'), sans-serif !important;
    font-size: 26px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    /* Header background is the dark --primary gradient — white text. */
    color: #FFFFFF !important;
    -webkit-text-fill-color: #FFFFFF !important;
    letter-spacing: -0.5px;
}

.brand-info p,
.brand-subtitle {
    font-size: 13px !important;
    color: rgba(255, 255, 255, 0.85) !important;
    margin: 0 !important;
    font-weight: 500 !important;
    letter-spacing: 0.3px;
}

/* Header Menu Button — the header itself is now the dark --primary
   gradient, so a solid --primary button here would blend in. Uses the same
   translucent "ghost" treatment as .action-button.primary below. */
.header-menu-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 12px;
}

.header-menu-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.28);
}

.header-menu-btn i {
    font-size: 22px;
    color: #FFFFFF !important;  /* White icon on dark purple background */
}

/* Hide menu button on mobile (use sidebar toggle instead) */
@media (max-width: 768px) {
    .header-menu-btn {
        display: none;
    }
}

/* Navigation Pills - Professional */
.nav-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 4px;
}

.nav-pill {
    display: flex !important;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 12px;
    text-decoration: none !important;
    color: rgba(100, 116, 139, 0.8) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(30, 41, 59, 0.9) !important;
    transform: translateY(-1px);
}

.nav-pill.active {
    background: linear-gradient(135deg, #047857 0%, #059669 100%) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.3);
}

.nav-pill i {
    font-size: 16px;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator-modern {
    /* Header background is the dark --primary gradient — translucent white
       pill + white text, same treatment as .action-button.primary. */
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #10B981, #34D399);
    border-radius: 50%;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.action-button {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 10px 18px !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Header background is the dark --primary gradient — a solid --primary
   button here would blend in, so this uses a translucent "ghost" style
   instead (same pattern as .header-menu-btn / .status-indicator-modern). */
.action-button.primary {
    background: rgba(255, 255, 255, 0.18) !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    color: white !important;
    box-shadow: none !important;
    font-weight: 600 !important;
}

.action-button.primary:hover {
    transform: translateY(-2px) !important;
    background: rgba(255, 255, 255, 0.28) !important;
}

.action-button.secondary {
    background: #FFFFFF !important;
    color: #475569 !important;
    border: 1px solid #E2E8F0 !important;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.action-button.secondary:hover {
    background: #F8FAFC !important;
    color: #0F172A !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12) !important;
    border-color: #CBD5E1 !important;
}

/* Profile Modal */
.profile-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.profile-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-modal-content {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.profile-modal-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: #ef4444;
    transform: rotate(90deg);
}

.profile-modal-body {
    padding: 24px;
}

.profile-avatar {
    text-align: center;
    margin-bottom: 24px;
}

.profile-avatar i {
    font-size: 80px;
    color: var(--primary);
}

.profile-info {
    space-y: 16px;
}

.profile-field {
    margin-bottom: 16px;
}

.profile-field label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.profile-field p {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
    font-weight: 500;
}

.profile-modal-footer {
    padding: 24px;
    border-top: 1px solid #e5e7eb;
    text-align: right;
}

.btn-secondary {
    padding: 10px 24px;
    background: #64748b;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
}

/* Animations */
@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-2px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Spinning animation for loading */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.mdi-spin {
    animation: spin 1s linear infinite;
}

/* Adjust main content padding */
.pt-header {
    padding-top: 120px !important;
}

/* Mobile Responsiveness */
@media (max-width: 1200px) {
    .nav-pills {
        gap: 4px;
    }
    
    .nav-pill {
        padding: 6px 12px;
        font-size: 12px !important;
    }
    
    .nav-pill span {
        display: none;
    }
    
    .btn-text {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .floating-header {
        top: 12px;
        left: 12px;
        right: 12px;
    }
    
    .floating-header-content {
        padding: 12px 20px;
    }
    
    .brand-info p,
    .brand-subtitle {
        display: none !important;
    }
    
    .nav-pills {
        display: none;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .action-button span {
        display: none !important;
    }
    
    .action-button {
        padding: 8px 12px !important;
    }
    
    .pt-header {
        padding-top: 100px !important;
    }
    
    .status-indicator-modern {
        display: none;
    }
}

/* Content padding for fixed header */
body {
    padding-top: 80px;
    overflow-x: hidden; /* Prevent horizontal scroll when sidebar opens */
}

/* Container adjustments */
.container {
    padding-top: 20px;
}

/* Prevent body scroll when sidebar is open on mobile */
body.sidebar-open {
    overflow: hidden;
}

/* Ensure header never shifts when sidebar opens */
body.sidebar-open .floating-header {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    transform: none !important;
}

@media (max-width: 480px) {
    .brand-info h1,
    .brand-title {
        font-size: 20px !important;
    }
    
    #profileBtn {
        display: none;
    }
}