/**
 * Cbran Management Admin Styles
 * Version: 6.1.1
 */

/* Hide WordPress UI elements on our plugin page - but keep admin menu and admin bar visible in backend */
body.toplevel_page_cbran_management #wpfooter,
body.cbran-frontend-view #wpadminbar {
    display: none;
}

/* Keep admin menu and admin bar visible in backend */
body.toplevel_page_cbran_management #adminmenumain {
    display: block !important;
}

body.toplevel_page_cbran_management #wpadminbar {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    z-index: 9999 !important;
}

/* Adjust wpcontent to account for admin menu when visible */
body.toplevel_page_cbran_management #wpcontent {
    margin-left: 160px !important;
    padding-left: 20px !important;
}

body.toplevel_page_cbran_management.folded #wpcontent {
    margin-left: 36px !important;
}

body.toplevel_page_cbran_management #wpwrap {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Main Layout Wrapper */
.cbran-management-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: #f9fafb; /* bg-gray-50 */
    margin-left: 0;
    width: 100%;
}

/* Adjust wrapper for admin bar in backend */
body.toplevel_page_cbran_management .cbran-management-wrapper {
    margin-top: 32px; /* Account for WordPress admin bar height */
    min-height: calc(100vh - 32px); /* Adjust min-height for admin bar */
}

@media screen and (max-width: 782px) {
    body.toplevel_page_cbran_management .cbran-management-wrapper {
        margin-top: 46px; /* Account for mobile admin bar height */
        min-height: calc(100vh - 46px); /* Adjust min-height for mobile admin bar */
    }
}

/* General SVG icon fix */
.cbran-management-wrapper svg {
    flex-shrink: 0;
}

/* Sidebar (Left Panel) */
.cbran-sidebar {
    width: 280px;
    flex-shrink: 0;
    padding: 0.75rem; /* Reduced from 1.5rem for desktop */
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1; /* Below WordPress admin menu (z-index: 9990) */
    transition: transform 0.3s ease-in-out, width 0.3s ease-in-out;
    overflow: visible;
}

/* Larger screens - wider sidebar */
@media (min-width: 1400px) {
    .cbran-sidebar {
        width: 320px;
        padding: 1rem; /* Reduced padding for more space */
    }
}

/* Extra large screens - even wider sidebar */
@media (min-width: 1920px) {
    .cbran-sidebar {
        width: 360px;
        padding: 1.25rem; /* Reduced padding for more space */
    }
}

.sidebar-inner {
    background-color: #ffffff;
    border-radius: 1rem; /* rounded-2xl */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Adjust sidebar height for admin bar in backend */
body.toplevel_page_cbran_management .cbran-sidebar {
    height: calc(100vh - 32px - 1.5rem); /* Account for WordPress admin bar height and reduced padding */
    top: calc(32px + 0.75rem); /* Position below admin bar with reduced padding */
}

body.toplevel_page_cbran_management .sidebar-inner {
    height: 100%;
}

@media screen and (max-width: 782px) {
    body.toplevel_page_cbran_management .cbran-sidebar {
        height: calc(100vh - 46px - 1.5rem); /* Account for mobile admin bar height and reduced padding */
        top: calc(46px + 0.75rem); /* Position below mobile admin bar with reduced padding */
    }
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f3f4f6; /* border-gray-100 */
    flex-shrink: 0; /* Prevent header from shrinking */
}

.sidebar-nav-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* Important for flexbox scrolling */
    /* Custom scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.sidebar-nav-container::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.sidebar-nav-container::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

.sidebar-nav-container::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

.sidebar-nav {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* space-y-2 */
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #e5e7eb; /* border-gray-200 */
    flex-shrink: 0; /* Prevent footer from shrinking */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background-color: #f9fafb; /* Light background for footer */
}

.sidebar-footer #cbran-profile-header-btn {
    text-align: left;
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.sidebar-footer #cbran-profile-header-btn:hover:not(:disabled) {
    background-color: #ffffff;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.sidebar-footer #cbran-profile-header-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.sidebar-footer #cbran-profile-header-btn .w-10 {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
}

.sidebar-footer #cbran-profile-header-btn .text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.sidebar-footer #cbran-profile-header-btn .text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.sidebar-footer a[href*="logout"] {
    margin-top: 0.25rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.sidebar-footer a[href*="logout"]:hover {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

/* Main Content (Right Panel) */
.cbran-main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - 280px); /* Ocupa el espacio restante */
    min-width: 0; /* Allow flexbox to shrink */
}

/* Larger screens - adjust main content width */
@media (min-width: 1400px) {
    .cbran-main-content {
        width: calc(100% - 320px);
    }
}

/* Extra large screens - adjust main content width */
@media (min-width: 1920px) {
    .cbran-main-content {
        width: calc(100% - 360px);
    }
}

/* Adjust wrapper width when admin menu is visible */
body.toplevel_page_cbran_management .cbran-management-wrapper {
    width: 100%; /* Full width within wpcontent */
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Ensure wpcontent has proper width calculation */
body.toplevel_page_cbran_management #wpcontent {
    width: calc(100% - 160px) !important;
    max-width: 100% !important;
}

body.toplevel_page_cbran_management.folded #wpcontent {
    width: calc(100% - 36px) !important;
    max-width: 100% !important;
}

/* Mobile menu button - only visible on mobile */
.content-header-mobile {
    display: none;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

@media (max-width: 768px) {
    .content-header-mobile {
        display: block;
    }
}

.content-body {
    padding: 1.5rem;
    flex-grow: 1;
    overflow-y: auto;
}

.content-body-inner {
    background-color: #ffffff;
    border-radius: 1rem; /* rounded-2xl */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 2rem;
    min-height: calc(100vh - 4rem);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Sidebar Mobile */
    .cbran-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 40;
        width: 280px;
        max-width: 85vw;
        padding: 1rem;
        height: 100vh;
    }
    .cbran-sidebar.is-open {
        transform: translateX(0);
    }
    
    .sidebar-inner {
        border-radius: 0.75rem;
        height: calc(100vh - 2rem);
    }
    .cbran-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 39;
    }
    .cbran-sidebar-overlay.is-open {
        display: block;
    }

    /* Main Content Mobile */
    .cbran-main-content {
        width: 100%;
    }

    .content-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .content-header h1 {
        font-size: 1.25rem;
        flex: 1;
        min-width: 0;
    }

    .content-body {
        padding: 0.75rem;
    }
    
    /* Tables - Convert to cards on mobile */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        display: block;
        width: 100%;
    }
    
    thead {
        display: none;
    }
    
    tbody {
        display: block;
        width: 100%;
    }
    
    tr {
        display: block;
        margin-bottom: 1rem;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 1rem;
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    }
    
    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid #f3f4f6;
    }
    
    td:last-child {
        border-bottom: none;
    }
    
    td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        margin-right: 1rem;
        flex-shrink: 0;
    }
    
    /* Grid layouts - stack on mobile */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
    
    /* Forms Mobile */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="date"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem !important;
        min-height: 44px !important; /* Touch target size */
    }
    
    /* Buttons Mobile */
    button,
    .button,
    input[type="submit"],
    a.button {
        min-height: 44px !important; /* Touch target size */
        padding: 0.75rem 1rem !important;
        font-size: 1rem !important;
    }
    
    /* Modal Mobile */
    .cbran-modal {
        width: calc(100% - 1rem) !important;
        max-width: calc(100% - 1rem) !important;
        margin: 0.5rem !important;
        max-height: calc(100vh - 1rem) !important;
        top: 0.5rem !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        transform: none !important;
        border-radius: 0.5rem;
    }
    
    .cbran-modal-overlay {
        background-color: rgba(0, 0, 0, 0.85);
    }
    
    /* Cards Mobile */
    .cbran-request-card .grid {
        grid-template-columns: 1fr;
    }
    
    .content-body-inner {
        padding: 1.25rem;
        border-radius: 0.75rem;
        min-height: auto;
    }
    
    .content-header-mobile {
        padding: 0.75rem;
    }
    
    /* Navigation Mobile */
    .sidebar-nav a,
    .sidebar-nav button {
        padding: 0.875rem 1rem !important;
        min-height: 44px !important;
    }
    
    /* Header Mobile */
    .sidebar-header {
        padding: 1rem;
    }
    
    .sidebar-header h1 {
        font-size: 1.125rem;
    }
    
    /* Footer Mobile */
    .sidebar-footer {
        padding: 1rem;
    }
    
    /* Action buttons mobile */
    .flex.gap-2,
    .flex.gap-3,
    .flex.gap-4 {
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }
    
    /* Search and filters mobile */
    .relative input[type="text"],
    .relative input[type="search"] {
        width: 100% !important;
    }
    
    /* Notification mobile */
    #cbran-notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
    
    .cbran-notification {
        min-width: auto;
        max-width: 100%;
        width: 100%;
    }
    
    /* Profile header mobile */
    #cbran-profile-header-btn {
        padding: 0.5rem;
    }
    
    /* Avatar mobile */
    .w-9.h-9 {
        width: 2rem;
        height: 2rem;
    }
    
    /* Text sizes mobile */
    .text-sm {
        font-size: 0.875rem;
    }
    
    .text-xs {
        font-size: 0.75rem;
    }
    
    /* Spacing mobile */
    .space-x-4 > * + * {
        margin-left: 0.5rem;
    }
    
    .space-y-6 > * + * {
        margin-top: 1rem;
    }
    
    /* Hide less important elements on mobile */
    .hidden-mobile {
        display: none !important;
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    .content-body {
        padding: 0.5rem;
    }
    
    .sidebar-header,
    .sidebar-footer {
        padding: 0.75rem;
    }
    
    .cbran-modal {
        padding: 1rem !important;
    }
    
    h1, h2, h3 {
        font-size: 1.125rem !important;
    }
    
    .text-2xl {
        font-size: 1.25rem !important;
    }
    
    .text-xl {
        font-size: 1.125rem !important;
    }
}

/* Tablet Styles (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .cbran-sidebar {
        width: 260px;
        padding: 0.75rem;
    }
    
    .cbran-main-content {
        width: calc(100% - 260px);
    }
    
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .content-body {
        padding: 0.75rem;
    }
    
    .content-body-inner {
        padding: 1.25rem;
    }
}

/* Medium screens (1025px - 1399px) - Desktop default */
@media (min-width: 1025px) and (max-width: 1399px) {
    .cbran-sidebar {
        width: 280px;
        padding: 0.75rem;
    }
    
    .cbran-main-content {
        width: calc(100% - 280px);
    }
    
    .content-body {
        padding: 0.75rem;
    }
    
    .content-body-inner {
        padding: 1.5rem;
    }
}

/* Touch-friendly improvements for all devices */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    button,
    a,
    input[type="button"],
    input[type="submit"],
    .button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Increase tap targets */
    .cbran-edit-user-btn,
    .cbran-view-user-btn,
    .cbran-delete-user-btn,
    .cbran-send-sms-btn {
        padding: 0.75rem !important;
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Better spacing for touch */
    .flex.items-center.space-x-4 > * + * {
        margin-left: 1rem;
    }
}


/* Modal Styles */
.modal-open {
    overflow: hidden;
}

.cbran-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 40;
}

.cbran-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    max-height: 90vh;
    overflow-y: auto;
    width: calc(100% - 2rem);
}
@media (min-width: 768px) {
    .cbran-modal {
        width: auto;
    }
}

/* Notification (Toast) Styles */
#cbran-notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cbran-notification {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 350px;
    animation: slideInRight 0.3s ease-out;
}
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
.cbran-notification svg {
    margin-right: 12px;
    flex-shrink: 0;
}
.cbran-notification.success {
    background-color: #ecfdf5; /* green-50 */
    color: #065f46; /* green-800 */
    border: 1px solid #a7f3d0; /* green-200 */
}
.cbran-notification.error {
    background-color: #fef2f2; /* red-50 */
    color: #991b1b; /* red-800 */
    border: 1px solid #fecaca; /* red-200 */
}

/* Frontend form notifications */
.cbran-form-container .cbran-notification {
    position: relative;
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- NEW Timeline/Conversation Styles --- */

/* System Event Style */
.cbran-system-event {
    text-align: center;
    margin: 1rem 0;
    font-size: 0.8rem;
    color: #6b7280; /* text-gray-500 */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cbran-system-event::before,
.cbran-system-event::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background-color: #e5e7eb; /* border-gray-200 */
}

/* Comment Attachment Styles */
#cbran-comment-attachment-preview {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.5rem;
    border-top: 1px solid #e5e7eb; /* border-gray-200 */
}

.cbran-comment-preview-item {
    position: relative;
}

.cbran-comment-preview-item img {
    width: 4rem; /* w-16 */
    height: 4rem; /* h-16 */
    object-fit: cover;
    border-radius: 0.375rem; /* rounded-md */
}

.cbran-remove-comment-attachment {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    background-color: #ef4444; /* bg-red-500 */
    color: white;
    width: 1rem;
    height: 1rem;
    border-radius: 9999px; /* rounded-full */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
}

/* Attachments inside comment bubbles */
.cbran-comment-attachment-gallery {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.cbran-comment-attachment-gallery img {
    width: 6rem; /* w-24 */
    height: 6rem; /* h-24 */
    object-fit: cover;
    border-radius: 0.375rem; /* rounded-md */
}

.cbran-comment-file-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px; /* rounded-full */
    font-size: 0.875rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}
.cbran-comment-file-attachment:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

/* Finances Accordion Styles */
.finances-accordion {
    position: relative;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.finances-accordion .accordion-arrow {
    transition: transform 0.2s ease-in-out;
}

.finances-accordion .accordion-arrow.rotate-180 {
    transform: rotate(180deg);
}

.finances-accordion .finances-sub-items {
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.finances-accordion .finances-sub-items a {
    transition: all 0.2s ease-in-out;
    margin-bottom: 0.25rem;
}

.finances-accordion .finances-sub-items a:last-child {
    margin-bottom: 0;
}

/* Settings Accordion Styles */
.settings-accordion {
    position: relative;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.settings-accordion .accordion-arrow {
    transition: transform 0.2s ease-in-out;
}

.settings-accordion .accordion-arrow.rotate-180 {
    transform: rotate(180deg);
}

.settings-accordion .settings-sub-items {
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.settings-accordion .settings-sub-items a {
    transition: all 0.2s ease-in-out;
    margin-bottom: 0.25rem;
}

.settings-accordion .settings-sub-items a:last-child {
    margin-bottom: 0;
}

/* Forms Accordion Styles */
.forms-accordion {
    position: relative;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.forms-accordion .accordion-arrow {
    transition: transform 0.2s ease-in-out;
}

.forms-accordion .accordion-arrow.rotate-180 {
    transform: rotate(180deg);
}

.forms-accordion .forms-sub-items {
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.forms-accordion .forms-sub-items a {
    transition: all 0.2s ease-in-out;
    margin-bottom: 0.5rem;
}

.forms-accordion .forms-sub-items a:last-child {
    margin-bottom: 0;
}

/* Welcome Modal Styles */
#cbran-welcome-modal {
    max-width: 42rem; /* max-w-2xl */
}

.cbran-welcome-activity-item {
    cursor: pointer;
    text-decoration: none;
}

.cbran-welcome-activity-item:hover {
    transform: translateX(4px);
}

.cbran-welcome-activity-item:active {
    transform: translateX(2px);
}

/* Modern Button Styles - Override WordPress default buttons */
.cbran-management-wrapper .button,
.cbran-management-wrapper .button-primary,
.cbran-management-wrapper input[type="submit"],
.cbran-management-wrapper input#submit,
.cbran-management-wrapper button[type="submit"]:not(.cbran-close-modal-btn):not(.edit-sms-notification-btn):not(.remove-field-btn):not(.edit-field-btn):not(.cbran-delete-form-btn):not(.remove-method-btn):not(.cbran-remove-attachment-btn):not(.cbran-remove-comment-attachment),
.cbran-management-wrapper .button.button-primary,
.cbran-management-wrapper button.button-primary {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    white-space: nowrap !important;
    border-radius: 0.375rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    height: 2.5rem !important;
    padding: 0.5rem 1rem !important;
    background-color: #2563eb !important;
    color: white !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.cbran-management-wrapper .button:hover,
.cbran-management-wrapper .button-primary:hover,
.cbran-management-wrapper input[type="submit"]:hover,
.cbran-management-wrapper input#submit:hover,
.cbran-management-wrapper button[type="submit"]:not(.cbran-close-modal-btn):not(.edit-sms-notification-btn):not(.remove-field-btn):not(.edit-field-btn):not(.cbran-delete-form-btn):not(.remove-method-btn):not(.cbran-remove-attachment-btn):not(.cbran-remove-comment-attachment):hover,
.cbran-management-wrapper .button.button-primary:hover,
.cbran-management-wrapper button.button-primary:hover {
    background-color: #1d4ed8 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.cbran-management-wrapper .button:active,
.cbran-management-wrapper .button-primary:active,
.cbran-management-wrapper input[type="submit"]:active,
.cbran-management-wrapper input#submit:active,
.cbran-management-wrapper button[type="submit"]:not(.cbran-close-modal-btn):not(.edit-sms-notification-btn):not(.remove-field-btn):not(.edit-field-btn):not(.cbran-delete-form-btn):not(.remove-method-btn):not(.cbran-remove-attachment-btn):not(.cbran-remove-comment-attachment):active,
.cbran-management-wrapper .button.button-primary:active,
.cbran-management-wrapper button.button-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

.cbran-management-wrapper .button:focus,
.cbran-management-wrapper .button-primary:focus,
.cbran-management-wrapper input[type="submit"]:focus,
.cbran-management-wrapper input#submit:focus,
.cbran-management-wrapper button[type="submit"]:not(.cbran-close-modal-btn):not(.edit-sms-notification-btn):not(.remove-field-btn):not(.edit-field-btn):not(.cbran-delete-form-btn):not(.remove-method-btn):not(.cbran-remove-attachment-btn):not(.cbran-remove-comment-attachment):focus,
.cbran-management-wrapper .button.button-primary:focus,
.cbran-management-wrapper button.button-primary:focus {
    outline: 2px solid transparent !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3) !important;
}

/* Secondary button styles */
.cbran-management-wrapper .button-secondary,
.cbran-management-wrapper .button.button-secondary {
    background-color: #6b7280 !important;
    color: white !important;
}

.cbran-management-wrapper .button-secondary:hover,
.cbran-management-wrapper .button.button-secondary:hover {
    background-color: #4b5563 !important;
    color: white !important;
}

/* Form Fields Drag and Drop Styles */
.field-item {
    cursor: move;
    cursor: grab;
    user-select: none;
    position: relative;
    transition: all 0.2s ease;
}

.field-item:active {
    cursor: grabbing;
}

.field-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    border-color: #3b82f6 !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    z-index: 1000;
}

.field-item.drag-over {
    border-color: #3b82f6 !important;
}

.field-item .drag-handle {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    cursor: grab;
    display: flex;
    align-items: center;
    padding: 4px;
    z-index: 10;
}

.field-item .drag-handle:active {
    cursor: grabbing;
}

.field-item .drag-handle svg {
    width: 16px;
    height: 16px;
}

.field-item:hover .drag-handle {
    color: #6b7280;
}

/* Prevent buttons from interfering with drag */
.field-item button {
    pointer-events: auto;
    cursor: pointer;
}

.field-item.dragging button {
    pointer-events: none;
}

/* Ensure user action buttons are clickable */
.cbran-view-user-btn,
.cbran-edit-user-btn,
.cbran-delete-user-btn {
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

/* Ensure SVGs inside buttons don't block clicks */
.cbran-view-user-btn svg,
.cbran-edit-user-btn svg,
.cbran-delete-user-btn svg {
    pointer-events: none;
}