


body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

body.index-page {
    padding: 0;
}

body.generate-page,
body.preview-page {
    padding: 0;
}

.bg-gradient-primary {
    background: linear-gradient(240deg, #57A892, #2E6D89);
}

.top-bar {
    position: sticky;
    top: 0;
    width: 100%;
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    z-index: 50;
    min-height: 60px;
}

.top-bar-container {
    max-width: 100%;
    margin: 0;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    gap: 20px;
}

.top-bar-title {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    font-family: "Urbanist", sans-serif;
    letter-spacing: 0.5px;
    white-space: nowrap;
    text-align: left;
    flex-shrink: 0;
}

.top-bar-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: 70px;
}

.top-bar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 3.5px 14px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    font-family: "Urbanist", sans-serif;
    transition: all 0.3s ease;
    white-space: nowrap;
    cursor: pointer;
}

.top-bar-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.top-bar-btn.active {
    background-color: #E0F2FE;
    border-color: #1D5E90;
    color: #295E90;
    box-shadow: 0 2px 10px rgba(29, 94, 144, 0.2);
}

.top-bar-btn.active:hover {
    background-color: #D0E8F8;
    border-color: #1D5E90;
    color: #295E90;
}

.top-bar-btn.active .top-bar-btn-icon {
    filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2000%) hue-rotate(195deg) brightness(0.4);
}

.top-bar-btn-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

.top-bar-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.top-bar-btn.disabled:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: none;
    box-shadow: none;
}

.top-bar-right-icons {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    margin-right: 20px;
}

.top-bar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.top-bar-icon-btn[title="Notification"] {
    background-color: transparent;
    border: none;
    width: auto;
    height: auto;
    padding: 4px;
}

.top-bar-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.top-bar-icon-btn[title="Notification"]:hover {
    background-color: transparent;
    border: none;
    box-shadow: none;
    opacity: 0.8;
}

.top-bar-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

/* Ensure profile pictures display with original colors - no filters or modifications */
.top-bar-account-btn,
.top-bar-account-btn img,
.account-dropdown img[src*="picture"],
.account-dropdown img[alt="User"] {
    filter: none !important;
    opacity: 1 !important;
    mix-blend-mode: normal !important;
    color-scheme: normal !important;
    image-rendering: auto !important;
    -webkit-filter: none !important;
    isolation: isolate !important;
    will-change: auto !important;
}

/* Specifically target profile picture images to prevent any color shifts */
.top-bar-account-btn img[src*="googleusercontent"],
.top-bar-account-btn img[src*="googleapis"],
.top-bar-account-btn img[src*="lh3.googleusercontent"],
.top-bar-account-btn img[src*="photo"],
.account-dropdown img[src*="googleusercontent"],
.account-dropdown img[src*="googleapis"],
.account-dropdown img[src*="lh3.googleusercontent"],
.account-dropdown img[src*="photo"] {
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    mix-blend-mode: normal !important;
    isolation: isolate !important;
}

.page-nav {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 20px 16px 20px;
    margin-bottom: 24px;
    margin-top: -10px;
    background: transparent;
    border: none;
    box-shadow: none;
    position: relative;
}

.page-nav::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background-color: #e5e7eb;
    opacity: 0.5;
}

.page-nav-btn {
    padding: 4px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    background-color: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    line-height: 1.2;
}

.page-nav-btn:hover {
    background-color: #e5e7eb;
    border-color: #2596be;
    color: #2596be;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 150, 190, 0.2);
}

.page-nav-btn.active {
    background-color: #2596be;
    border-color: #2596be;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(37, 150, 190, 0.3);
}

.page-nav-btn.active:hover {
    background-color: #1e7a9e;
    border-color: #1e7a9e;
    color: #ffffff;
}

.top-bar-brand {
    display: flex;
    align-items: center;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
}

.top-bar-logo {
    height: 32px;
    width: auto;
    display: block;
}

.top-bar-menu {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: none;
}

.top-bar-menu span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 1px;
}

/* Main Layout with Sidebar */
.main-layout {
    display: flex;
    min-height: calc(100vh - 70px);
    background-color: #f4f7f9;
}

/* Sidebar Navigation */
.sidebar-nav {
    width: 280px;
    background-color: #ffffff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    transition: width 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px 16px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.sidebar-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px 4px 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-menu-btn:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.sidebar-menu-btn svg {
    width: 20px;
    height: 20px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
}

.sidebar-logo-img {
    height: 32px;
    width: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.sidebar-logo-img-small {
    height: 24px;
    width: auto;
    display: none;
}

.sidebar-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 0 20px;
    opacity: 0.5;
    transition: margin 0.3s ease;
}

.sidebar-content {
    padding: 24px 20px;
    flex: 1;
    transition: padding 0.3s ease;
}

.sidebar-add-study-btn-container {
    transition: all 0.3s ease;
}

.add-study-text {
    transition: opacity 0.3s ease;
}

.add-study-icon {
    display: none;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.study-nav-text {
    transition: opacity 0.3s ease;
}

/* Minimized Sidebar Styles */
.sidebar-nav.minimized {
    width: 80px;
}

.sidebar-nav.minimized .sidebar-header {
    padding: 24px 12px 16px 12px;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}

.sidebar-nav.minimized .sidebar-logo {
    justify-content: center;
}

.sidebar-nav.minimized .sidebar-logo-img {
    display: none;
}

.sidebar-nav.minimized .sidebar-logo-img-small {
    display: block;
}

.sidebar-nav.minimized .sidebar-divider {
    margin: 0 12px;
}

.sidebar-nav.minimized .sidebar-content {
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar-nav.minimized .sidebar-add-study-btn-container {
    width: 100%;
    margin-bottom: 20px;
}

.sidebar-nav.minimized .sidebar-add-study-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    border-radius: 12px;
    box-sizing: border-box;
}

.sidebar-nav.minimized .add-study-text {
    display: none;
}

.sidebar-nav.minimized .add-study-icon {
    display: block;
    filter: brightness(0) invert(1);
}

.sidebar-nav.minimized .sidebar-title {
    display: none;
}

.sidebar-nav.minimized .studies-nav {
    width: 100%;
}

.sidebar-nav.minimized .study-nav-item {
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    background: linear-gradient(90deg, #1D6091, #1588AC);
    color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-nav.minimized .study-nav-text {
    display: none;
}

.sidebar-nav.minimized .study-nav-icon {
    margin-right: 0;
    filter: brightness(0) invert(1);
}

.sidebar-nav.minimized .sidebar-empty {
    display: none;
}

.sidebar-study-name {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 24px;
    background-color: #f3f4f6;
    border-radius: 8px;
    border-left: 3px solid #2596be;
}

.sidebar-study-name-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #2596be;
}

.sidebar-study-name-text {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
    word-break: break-word;
}

.sidebar-title {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    text-transform: none;
    letter-spacing: 0.3px;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
    text-align: center;
}

.sidebar-title-with-refresh {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    margin-bottom: 20px;
}

.sidebar-title-with-refresh .sidebar-title {
    margin: 0;
    flex: 0 0 auto;
    line-height: 1.2;
}

.refresh-studies-btn {
    background: none !important;
    border: none !important;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    outline: none !important;
    box-shadow: none !important;
}

.refresh-studies-btn:active,
.refresh-studies-btn:focus,
.refresh-studies-btn:focus-visible {
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.refresh-studies-btn:hover:not(:disabled) {
    opacity: 1;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.refresh-studies-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.refresh-studies-btn.loading img {
    animation: spin 1s linear infinite;
}

.refresh-icon {
    width: 16px;
    height: 16px;
    filter: brightness(0) saturate(100%) invert(40%);
    transition: filter 0.2s ease;
}

.refresh-studies-btn:hover:not(:disabled) .refresh-icon {
    filter: brightness(0) saturate(100%) invert(20%);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sidebar-nav.minimized .sidebar-title-with-refresh {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.sidebar-nav.minimized .sidebar-title-with-refresh .sidebar-title {
    display: none;
}

.sidebar-nav.minimized .refresh-studies-btn {
    margin-top: 0;
}

.studies-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.study-nav-item {
    border: none;
    padding: 10px 20px;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-family: "Urbanist", sans-serif;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid transparent;
    position: relative;
}

/* Expanded sidebar study items - gradient pill style */
.sidebar-nav:not(.minimized) .study-nav-item {
    background: linear-gradient(90deg, #1D6091, #1588AC);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-nav:not(.minimized) .study-nav-item .study-nav-icon {
    margin-right: 8px;
    filter: brightness(0) invert(1);
}

.sidebar-nav:not(.minimized) .study-nav-item .study-nav-text {
    color: #ffffff;
}

.sidebar-nav:not(.minimized) .study-nav-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.sidebar-nav:not(.minimized) .study-nav-item.active {
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    border: 2px solid #1D5E90;
}

/* White line on left inside button for active study */
.sidebar-nav:not(.minimized) .study-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 4px;
    background-color: #ffffff;
    border-radius: 0 4px 4px 0;
}

/* Minimized: keep same outline + white line for active study */
.sidebar-nav.minimized .study-nav-item.active {
    border: 2px solid #1D5E90;
}

.sidebar-nav.minimized .study-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 4px;
    background-color: #ffffff;
    border-radius: 0 4px 4px 0;
}

.sidebar-empty {
    color: #6b7280;
    font-size: 14px;
    padding: 12px 16px;
    margin: 0;
    font-style: italic;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 10px 48px 40px 48px;
    max-width: calc(100% - 280px);
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    transition: max-width 0.3s ease, padding 0.3s ease;
}

/* Adjust main content when sidebar is minimized */
.sidebar-nav.minimized ~ .main-content {
    max-width: calc(100% - 80px);
}

.main-content .page-content {
    max-width: 100%;
    margin: 0;
    padding: 0 20px 0 20px;
    box-sizing: border-box;
    overflow-x: hidden;
    margin-top: -10px;
}

.studies-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 40px auto 24px auto;
    max-width: 1200px;
    width: 100%;
    margin-bottom: 40px;
}

.study-info-container,
.study-info-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px 28px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.study-info-card.selected {
    border: 2px solid #87ceeb;
    box-shadow: 0 4px 16px rgba(135, 206, 235, 0.3);
}

.study-info-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    border-top: none;
    border-left: none;
    border-right: none;
}

.study-info-name {
    margin: 0;
    padding: 0;
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
    line-height: 1.2;
    text-align: center;
    border: none !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

.study-info-details {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
    align-items: center;
}

.study-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.study-info-label {
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
}

.study-info-value {
    font-size: 16px;
    color: #1f2937;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
    font-weight: 500;
}

.study-info-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.study-info-empty {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-size: 16px;
}

/* Protocol Card Styles */
.protocol-card-container {
    max-width: 1200px;
    width: 100%;
    margin: 40px auto 24px auto;
    padding: 0 20px;
    clear: both;
    position: relative;
    z-index: 1;
    min-height: 200px;
}

.protocol-card-container.hidden {
    display: none;
}

.protocol-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #e5e7eb;
}

.protocol-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 0;
    border-bottom: none;
}

.protocol-card-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
    border: none !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
}

.protocol-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

.protocol-close-btn:hover {
    color: #1f2937;
}

.protocol-card-body {
    position: relative;
    min-height: 300px;
}

/* Override loading indicator styles for protocol card */
.protocol-card-body .loading-indicator {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background-color: transparent;
    border-radius: 0;
    z-index: 1;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
}

.protocol-card-body .loading-indicator.hidden {
    display: none;
}

.protocol-info-section {
    background: linear-gradient(135deg, #1589AC 0%, #1D5E90 100%);
    color: white;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.protocol-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.protocol-info-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 16px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.protocol-info-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.protocol-info-value {
    font-size: 16px;
    font-weight: 500;
}

.protocol-section-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.protocol-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #1D5E90;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #1589AC;
}

.main-content-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 24px;
}

.study-btn.soa-btn {
    background-color: #0570bd;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(5, 112, 189, 0.25);
    padding: 10px 24px;
    width: 120px;
    height: 40px;
    font-size: 14px;
    font-weight: 600;
    box-sizing: border-box;
    line-height: 1;
}

.study-btn.soa-btn:hover {
    background-color: #045a9a;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(4, 90, 154, 0.3);
}

/* New Study Form in Main Content */
.main-content .new-study-form {
    margin-top: 32px;
}

.main-content .new-study-form.hidden {
    display: none;
}

.main-content .error-box {
    margin-top: 24px;
}

.page-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 20px 40px 20px;
    display: block;
    box-sizing: border-box;
    overflow-x: hidden;
    width: 100%;
}

/* Override for index page layout */
body.index-page .page-content {
    max-width: 100%;
    padding: 0;
}

.page-heading {
    margin: 0 0 20px 0;
    font-size: 48px;
    color: #14248a;
    font-family: "Times New Roman", Times, serif;
    text-align: center;
    font-weight: 700;
}

.previous-studies {
    margin-top: 32px;
}

.section-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.section-header,
.new-study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.section-header .section-title {
    margin: 0;
}

.new-study-header {
    margin-bottom: 12px;
}

.section-footer {
    margin-top: 28px;
    display: flex;
    justify-content: center;
}

.icon-btn {
    background: transparent;
    border: none;
    color: #0f172a;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover {
    background-color: rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.studies-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.studies-header {
    display: grid;
    grid-template-columns: 2fr 2fr 2fr 1fr;
    gap: 16px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #475569;
}

.study-item {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 8px 24px;
    display: grid;
    grid-template-columns: 2fr 2fr 2fr 1fr;
    align-items: center;
    gap: 16px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
}

.study-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.12);
}

.study-name {
    margin: 0;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: #0f172a;
}

.study-id,
.study-updated {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
    font-size: 14px;
    color: #1f2937;
}

.study-id .label,
.study-updated .label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    display: none;
}

.study-id .value,
.study-updated .value {
    font-size: 14px;
    font-family: "Calibri", "Candara", "Segoe", "Segoe UI", "Optima", Arial, sans-serif;
    color: #1f2937;
}

.study-actions {
    display: flex;
    align-items: flex-start;
}

.empty-state {
    background: #f8fafc;
    border: 1px dashed #cbd5f5;
    border-radius: 10px;
    padding: 24px;
    color: #475569;
    font-size: 15px;
}

.new-study-form {
    margin-top: 56px;
}

.upload-card.compact {
    max-width: 720px;
    margin: 0 auto;
    padding: 36px 40px;
    position: relative;
}

.upload-card.is-disabled {
    opacity: 0.6;
    pointer-events: none;
}

.upload-section.compact {
    gap: 20px;
}

.form-field {
    position: relative;
}

.form-field.error input[type="text"],
.form-field.error input[type="file"],
.form-field.error textarea {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.field-error {
    display: none;
    color: #b91c1c;
    font-size: 12px;
    margin-top: 6px;
    font-family: "Times New Roman", Times, serif;
}

.form-field.error .field-error {
    display: block;
}

.form-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field textarea:focus {
    outline: none;
    border-color: #57A892;
    box-shadow: 0 0 0 3px rgba(87, 168, 146, 0.1);
}

.form-field label .required {
    color: #dc2626;
    margin-left: 2px;
}

.new-study-form-section {
    margin-top: 48px;
    padding: 0 20px;
}

.new-study-form-section.hidden {
    display: none;
}

.new-study-form-section .upload-card {
    max-width: 900px;
    margin: 0 auto;
}

.new-study-form-section .upload-card .section-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}

.new-study-form-section .upload-card .section-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.new-study-form-section .upload-card .icon-btn {
    font-size: 24px;
    color: #6b7280;
}

.new-study-form-section .upload-card .icon-btn:hover {
    color: #111827;
    background-color: rgba(15, 23, 42, 0.08);
}

.study-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    border: none;
    cursor: pointer;
}

.study-btn.primary {
    background-color: #1589AC;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(5, 112, 189, 0.25);
    padding: 10px 24px;
    width: 120px;
    height: 40px;
    font-size: 14px;
    font-weight: 700;
    box-sizing: border-box;
    line-height: 1;
}

.study-btn.primary:hover {
    background-color: #127193;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(4, 90, 154, 0.3);
}

.study-btn.primary.protocol-btn {
    width: 150px;
}

.study-btn.secondary {
    background-color: #1D5E90;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(29, 94, 144, 0.25);
    padding: 10px 18px;
    font-family: "Urbanist", sans-serif;
}

.study-btn.secondary:hover {
    background-color: #154a73;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(21, 74, 115, 0.3);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.submit-btn {
    background-color: #2563eb;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

.submit-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(29, 78, 216, 0.25);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 6px 16px rgba(29, 78, 216, 0.2);
}

.submit-btn:disabled,
.submit-btn.is-disabled {
    background-color: #5c85f5;
    cursor: not-allowed;
    box-shadow: none;
}

.card-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
}

.page-content .divider {
    margin-top: 0;
}

.top-bar + .page-content {
    margin-top: 0;
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }

    .sidebar-nav {
        width: 100%;
        position: relative;
        top: 0;
        height: auto;
        max-height: 300px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .sidebar-study-name {
        padding: 10px 12px;
        margin-bottom: 16px;
    }

    .sidebar-study-name-icon {
        width: 18px;
        height: 18px;
    }

    .sidebar-study-name-text {
        font-size: 14px;
    }

    .main-content {
        max-width: 100%;
        padding: 24px 20px;
    }

    .page-nav {
        padding: 0 0 0 16px;
        margin-bottom: 16px;
        margin-top: -10px;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
    }

    .page-nav-btn {
        padding: 4px 12px;
        font-size: 13px;
    }

    .studies-grid-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .study-info-container,
    .study-info-card {
        padding: 16px 18px;
        max-width: 100%;
    }

    .study-info-name {
        font-size: 24px;
    }

    .study-info-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .study-info-details {
        gap: 12px;
        margin-bottom: 16px;
    }

    .study-info-row {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    .study-info-label {
        min-width: auto;
        font-size: 15px;
    }

    .study-info-value {
        font-size: 15px;
    }

    .study-info-actions {
        flex-direction: row;
        align-items: stretch;
        gap: 10px;
    }

    .study-info-actions .study-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 16px;
    }

    .top-bar {
        min-height: 50px;
    }

    .top-bar-title {
        font-size: 22px;
    }

    .top-bar-container {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 20px;
    }

    .top-bar-title {
        font-size: 24px;
    }

    .top-bar-buttons {
        gap: 6px;
        margin-left: 20px;
    }

    .top-bar-btn {
        padding: 3px 12px;
        font-size: 16px;
    }

    .top-bar-btn-icon {
        width: 16px;
        height: 16px;
    }

    .top-bar-nav {
        flex-wrap: wrap;
        gap: 8px;
    }

    .top-bar-nav-btn {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 20px;
        gap: 6px;
    }

    .top-bar-nav-btn.active::after {
        width: 50%;
        height: 2px;
    }

    .studies-header {
        display: none;
    }

    .study-item {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 18px 20px;
    }

    .study-id .label,
    .study-updated .label {
        display: block;
    }

    .page-content {
        padding: 80px 20px 32px;
    }

    .table-wrapper {
        min-width: 100%;
    }
}

.container {
    max-width: 720px;
    margin: 40px auto;
    padding: 30px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block;
    box-sizing: border-box;
}

/* Larger layout only for preview page */
/* Preview page: flexible container */
body.preview-page .container, .wide-container {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Generate page: flexible container */
body.generate-page .container {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Remove space below Forms heading on generate page */
body.generate-page .container h1 {
    margin-bottom: 0;
}

/* Editchecks page: flexible container */
body.editchecks-page .container {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Build page (index-page): flexible container */
body.index-page .container:not(.study-info-container):not(.study-info-card) {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Index page: wider container for better form layout */
body.index-page .container {
    max-width: 1400px; /* increased width for better form layout */
    background: transparent;
    box-shadow: none;
    padding-top: 40px;
}

/* Two column layout for templates */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 20px 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Remove space below Forms heading */
body.generate-page .container h1 + .two-column-layout {
    margin-top: 0;
}

/* Expand to single column when missing forms section is removed */
.two-column-layout.single-column-expanded {
    grid-template-columns: 1fr;
}

.two-column-layout.single-column-expanded #present-templates-section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Align Present Templates buttons with Generated Forms table Actions column when in single column */
.two-column-layout.single-column-expanded .form-list-item {
    display: grid;
    grid-template-columns: 70% 30%;
    align-items: center;
    gap: 0;
    padding: 8px 0;
}

.two-column-layout.single-column-expanded .form-name {
    max-width: 100%;
    padding-right: 12px;
    grid-column: 1;
}

.two-column-layout.single-column-expanded .action-icons {
    grid-column: 2;
    justify-content: center;
    margin-left: 0;
    gap: 8px;
}

/* Medium screens - allow wrapping */
@media (max-width: 1200px) {
    .form-name {
        max-width: 40%;
        flex: 0 1 auto;
    }
    
    .action-icons {
        flex: 0 0 auto;
        justify-content: flex-end;
        min-width: 0;
        gap: 4px;
    }
    
    .action-icon-btn {
        flex-shrink: 0;
        min-width: 24px;
        padding: 4px 5px;
    }
    
    .action-icon-btn.annotated-crf {
        font-size: 11px;
        padding: 4px 8px;
        white-space: nowrap;
    }
    
    .action-icon-btn.crf-specs,
    .action-icon-btn.annotated-crf {
        white-space: nowrap;
        word-break: normal;
    }
}

@media (max-width: 768px) {
    .two-column-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Make form list items stack vertically on small screens */
    .form-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .form-name {
        max-width: 100%;
        flex: 1 1 100%;
        width: 100%;
        padding-right: 0;
    }
    
    .action-icons {
        flex: 1 1 100%;
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-left: 0;
    }
    
    .action-icon-btn {
        font-size: 12px;
        padding: 4px 8px;
        flex-shrink: 1;
        white-space: normal;
        min-width: 0;
    }
    
    .action-icon-btn.crf-specs,
    .action-icon-btn.annotated-crf {
        padding: 1px 8px;
        font-size: 8px;
        flex-shrink: 1;
        white-space: normal;
        min-width: 0;
        border-radius: 6px;
        font-family: "Urbanist", sans-serif;
    }
}

/* Extra small screens (phones) */
@media (max-width: 480px) {
    .form-list-item {
        gap: 8px;
    }
    
    .action-icons {
        gap: 6px;
    }
    
    .action-icon-btn {
        font-size: 11px;
        padding: 3px 6px;
        min-width: auto;
    }
    
    .action-icon-btn.crf-specs,
    .action-icon-btn.annotated-crf {
        padding: 0px 6px;
        font-size: 7px;
        border-radius: 6px;
        font-family: "Urbanist", sans-serif;
    }
    
    .action-icon-btn .action-icon-img {
        width: 16px;
        height: 16px;
    }
}

/* Form card styling */
.form-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.form-card h4 {
    margin: 0 0 15px 0;
    color: #374151;
    font-size: 16px;
    font-weight: 600;
}

.form-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Hidden textarea for backend compatibility */
.hidden-field-input {
    display: none !important;
}

/* Field tags container */
.field-tags-container {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    min-height: 100px;
}

.field-tags-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.field-tags-actions {
    display: flex;
    gap: 8px;
}

.field-count {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
}

.btn-add-field {
    background-color: #10b981;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-add-field:hover {
    background-color: #059669;
}

.btn-refresh-suggestions {
    background-color: #7c3aed;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.btn-refresh-suggestions:hover {
    background-color: #6d28d9;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.btn-refresh-suggestions .ai-suggestions-icon {
    width: 14px;
    height: 14px;
    display: block;
    object-fit: contain;
    flex-shrink: 0;
}

.btn-refresh-suggestions .ai-suggestions-text {
    font-weight: 500;
    white-space: nowrap;
}

.btn-refresh-suggestions:disabled {
    background-color: #c4b5fd;
    cursor: not-allowed;
}

.field-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    align-items: flex-start;
}

.loading-fields {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: 14px;
    padding: 20px;
    justify-content: center;
    width: 100%;
}

.spinner-small {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #10b981;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

.field-tag {
    background-color: #e5e7eb;
    color: #374151;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #d1d5db;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: normal;
    word-wrap: break-word;
    max-width: 100%;
    margin-bottom: 4px;
    line-height: 1.4;
    cursor: pointer;
    position: relative;
}

.field-tag:hover {
    background-color: #d1d5db;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.field-tag.editing {
    background-color: #fef3c7;
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.field-tag-input {
    background: transparent;
    border: none;
    outline: none;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    flex: 1;
    min-width: 100px;
    font-family: inherit;
}

.field-tag-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.field-tag-delete:hover {
    opacity: 1;
    background-color: #fee2e2;
}

/* Legacy styles for auto-expand textarea (kept for compatibility) */
.auto-expand-textarea {
    overflow: hidden;
    resize: none;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Button styling */
.btn-suggest {
    background-color: #8b5cf6;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.btn-suggest:hover {
    background-color: #7c3aed;
}

.btn-suggest:disabled {
    background-color: #c4b5fd;
    cursor: not-allowed;
}

.btn-generate {
    background-color: #1D5E90;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: "Urbanist", sans-serif;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(29, 94, 144, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
}

.btn-generate .action-icon-img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-generate:hover {
    background-color: #1a4d75;
    box-shadow: 0 4px 8px rgba(29, 94, 144, 0.3);
    transform: translateY(-1px);
}

.btn-generate:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(29, 94, 144, 0.2);
}

.btn-generate:disabled {
    background-color: #9ca3af;
    color: #ffffff;
    border-color: #d1d5db;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

/* Regenerate button state - when btn-generate text is "Regenerate" */
.btn-generate[style*="background-color: #3b82f6"] {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2) !important;
}

.btn-generate[style*="background-color: #3b82f6"]:hover {
    background-color: #2563eb !important;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3) !important;
    transform: translateY(-1px) !important;
}

.btn-generate[style*="background-color: #3b82f6"]:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2) !important;
}

.btn-preview, .btn-regenerate {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.btn-preview {
    background-color: #3b82f6;
    color: white;
}

.btn-preview:hover {
    background-color: #2563eb;
}

/* Smart Suggest button styling */
.btn-regenerate {
    background-color: #7c3aed;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.btn-regenerate:hover {
    background-color: #6d28d9;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.btn-regenerate .smart-suggest-icon {
    width: 18px;
    height: 18px;
    display: block;
    object-fit: contain;
    flex-shrink: 0;
}

.btn-regenerate .smart-suggest-text {
    font-weight: 500;
    white-space: nowrap;
}

.btn-regenerate:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* Status indicators */
.form-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.status-generating {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-success {
    background-color: #dcfce7;
    color: #166534;
}

.status-error {
    background-color: #fee2e2;
    color: #dc2626;
}

.status-buttons {
    display: flex;
    gap: 8px;
}

.btn-preview-small, .btn-edit-small, .btn-save-small {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-preview-small {
    background-color: transparent;
    color: #0c5460;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
}

.btn-preview-small:hover {
    background-color: #f1f5f9;
}

.btn-edit-small {
    background-color: transparent !important;
    color: #5a6268 !important;
    border: none !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    font-weight: normal !important;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none !important;
    box-shadow: none !important;
    line-height: 1 !important;
}

.btn-edit-small:hover {
    background-color: #f1f5f9 !important;
    color: #5a6268 !important;
    text-decoration: none !important;
}

.btn-save-small {
    background-color: #10b981;
    color: white;
}

.btn-save-small:hover {
    background-color: #059669;
}

.btn-icon-small {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    object-fit: contain;
    flex-shrink: 0;
}

.btn-preview-small, .btn-edit-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.btn-preview-small img,
.btn-edit-small img {
    width: 18px;
    height: 18px;
    display: block;
    object-fit: contain;
}

.page-title { text-align: center; margin: 0 0 20px 0; font-size: 34px; }
.divider { height: 1px; background: #e5e7eb; margin: 24px 0 32px 0; }

.upload-card {
    max-width: 800px; /* increased width */
    margin: 0 auto; /* center */
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    padding: 28px;
}
.upload-card .upload-section { 
    justify-content: flex-start; 
    flex-direction: column; /* make fields vertical */
    gap: 15px; /* add spacing between fields */
}

h1, h2, h3, h4 {
    color: #1a253c;
    margin-top: 0;
}

h1 { font-size: 2em; margin-bottom: 0; }
h2 { font-size: 1.5em; border-bottom: 2px solid #eef2f5; padding-bottom: 10px; margin-bottom: 20px;}
h3 { font-size: 1.2em; }
h4 { font-size: 1em; margin-bottom: 10px; }


button, input[type="file"], .download-button {
    font-size: 16px;
    padding: 12px 20px;
    border-radius: 5px;
    border: 1px solid #ccc;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    vertical-align: middle;
}

button {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}

button:hover {
    background-color: #0056b3;
}

.upload-section {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
}

.upload-section .form-field {
    display: flex;
    align-items: center;
    gap: 16px;
}

.upload-section .form-field label {
    font-weight: 600;
    color: #374151;
    margin: 0;
    min-width: 150px;
    text-align: left;
    display: inline-flex;
    justify-content: flex-start;
    align-items: center;
}


/* Style for form inputs */
.upload-section .form-field input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    flex: 1;
}

.upload-section .form-field input[type="text"]:focus {
    outline: none;
    border-color: #57A892;
    box-shadow: 0 0 0 3px rgba(87, 168, 146, 0.1);
}

/* Style for file input */
.upload-section .form-field input[type="file"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    background-color: #f9fafb;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    flex: 1;
}

.upload-section input[type="file"]:hover {
    border-color: #3b82f6;
    background-color: #f0f9ff;
}

/* Style for the generate button */
.upload-section button {
    width: 100%;
    padding: 16px 24px;
    font-size: 18px;
    font-weight: 600;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-top: 10px;
}

.upload-section button:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

.upload-section button:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .upload-section .form-field {
        flex-direction: column;
        align-items: stretch;
    }

    .upload-section .form-field label {
        text-align: left;
        width: 100%;
        justify-content: flex-start;
    }

    .upload-section .form-field label::after {
        margin-left: 6px;
    }
}

/* --- Enhanced Table Styles --- */
.table-container { 
    margin-top: 30px; 
    overflow-x: auto; /* For responsiveness on small screens */
    overflow-y: visible; /* Allow vertical overflow for new rows */
    height: auto !important;
    max-height: none !important;
    min-height: auto !important;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Responsive wrapper for visits table */
.visits-table-container {
    position: relative;
    width: 100%;
}

.visits-table-container .table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    position: relative;
    max-width: 100%;
}

/* Custom scrollbar for better UX */
.visits-table-container .table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.visits-table-container .table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.visits-table-container .table-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.visits-table-container .table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Make visits table responsive and adjustable */
#visits_table {
    width: 100%;
    min-width: 800px; /* Minimum width to maintain readability */
    table-layout: auto;
    border-collapse: collapse;
}
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 15px; 
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    min-height: 100px; /* Ensure minimum height for visibility */
    table-layout: auto; /* Allow flexible column sizing */
    height: auto !important;
    max-height: none !important;
}
th, td { 
    border: 1px solid #dee2e6; 
    padding: 12px; 
    text-align: left; 
    vertical-align: middle;
}

/* Specific column widths for visits table */
#visits_table th:nth-child(1), #visits_table td:nth-child(1) { 
    min-width: 80px; /* Sequence controls */
    width: auto;
}
#visits_table th:nth-child(2), #visits_table td:nth-child(2) { 
    min-width: 150px; /* Visit Name */
    width: auto;
}
#visits_table th:nth-child(3), #visits_table td:nth-child(3) { 
    min-width: 120px; /* Visit OID */
    width: auto;
}
#visits_table th:nth-child(4), #visits_table td:nth-child(4) { 
    min-width: 80px; /* Visit Number */
    width: auto;
}
#visits_table th:nth-child(5), #visits_table td:nth-child(5) { 
    min-width: 200px; /* Assigned Forms */
    width: auto;
}
#visits_table th:nth-child(6), #visits_table td:nth-child(6) { 
    min-width: 100px; /* Actions */
    width: auto;
}

/* Specific column widths for forms table */
#forms_table th:nth-child(1), #forms_table td:nth-child(1) { 
    width: 20%; /* Form Name */
}
#forms_table th:nth-child(2), #forms_table td:nth-child(2) { 
    width: 15%; /* Form OID */
}
#forms_table th:nth-child(3), #forms_table td:nth-child(3) { 
    width: 15%; /* Domain Abbreviation */
}
#forms_table th:nth-child(4), #forms_table td:nth-child(4) { 
    width: 40%; /* Assigned Visits - much wider */
}
#forms_table th:nth-child(5), #forms_table td:nth-child(5) { 
    width: 10%; /* Actions */
}

/* Specific column widths for log forms table */
#log_forms_table th:nth-child(1), #log_forms_table td:nth-child(1) { 
    width: 45%; /* Form Name */
}
#log_forms_table th:nth-child(2), #log_forms_table td:nth-child(2) { 
    width: 45%; /* Form OID */
}
#log_forms_table th:nth-child(3), #log_forms_table td:nth-child(3) { 
    width: 10%; /* Actions */
}
th { 
    background-color: #add8e6; 
    font-weight: 600; 
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
    text-align: center;
}
tbody tr:nth-child(even) {
    background-color: #f8f9fa; /* Zebra striping for rows */
}
td input.editable-cell { 
    width: 100%; 
    padding: 8px; 
    border: 1px solid #ccc; 
    border-radius: 4px; 
    box-sizing: border-box;
    background-color: #fff;
    transition: all 0.2s ease-in-out;
    min-width: 0; /* Allow input to shrink if needed */
}
td input.editable-cell:focus { 
    border-color: #007bff; 
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}
.actions-column {
    width: 120px;
    text-align: center;
}
.actions-cell {
    text-align: center;
    vertical-align: middle;
    padding: 8px;
}

.actions-cell button {
    vertical-align: middle;
    margin: 0 2px;
}

.actions-cell .remove-row-btn,
.actions-cell .move-to-log-btn,
.actions-cell .move-to-other-btn,
.actions-cell .save-row-btn,
.actions-cell .cancel-row-btn {
    vertical-align: middle;
}

/* --- Add/Remove Button Styles --- */
.add-row-btn {
    margin-top: 10px;
    padding: 8px 16px;
    font-size: 14px;
    background-color: #6c757d;
    border-color: #6c757d;
}
.add-row-btn:hover {
    background-color: #5a6268;
}
.remove-row-btn {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: normal;
}
.remove-row-btn:hover {
    background-color: #c82333;
}

/* Save/Cancel button styles */
.save-row-btn {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: normal;
    margin-right: 5px;
}
.save-row-btn:hover {
    background-color: #218838;
}

.cancel-row-btn {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: normal;
}
.cancel-row-btn:hover {
    background-color: #5a6268;
}

/* New row styling - Very simple approach */
.new-row {
    background-color: #fff3cd !important;
    border: 2px solid #ffc107 !important;
}

.new-row td {
    background-color: #fff3cd !important;
    border: 1px solid #ffc107 !important;
    padding: 8px !important;
}

.new-row input {
    background-color: #fff !important;
    border: 1px solid #ffc107 !important;
    padding: 4px !important;
}

/* Ensure table can expand */
#visits_table tbody {
    min-height: 200px;
    height: auto !important;
    max-height: none !important;
}

#visits_table tbody tr {
    display: table-row !important;
    visibility: visible !important;
    height: auto !important;
}

/* Responsive adjustments for visits table */
@media screen and (max-width: 1200px) {
    .visits-table-container .table-wrapper {
        overflow-x: auto;
        display: block;
    }
    
    #visits_table {
        min-width: 900px; /* Ensure all columns are visible on medium screens */
    }
}

@media screen and (max-width: 768px) {
    .visits-table-container .table-wrapper {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    #visits_table {
        min-width: 1000px; /* Wider on mobile to prevent cramping */
        font-size: 0.9em;
    }
    
    #visits_table th,
    #visits_table td {
        padding: 8px;
        font-size: 0.9em;
    }
}

@media screen and (max-width: 480px) {
    #visits_table {
        min-width: 1100px;
        font-size: 0.85em;
    }
    
    #visits_table th,
    #visits_table td {
        padding: 6px;
        font-size: 0.85em;
    }
}

/* Sequence control buttons */
.sequence-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
}

.sequence-btn {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
    padding: 3px 6px;
    font-size: 10px;
    font-weight: normal;
    border-radius: 3px;
    cursor: pointer;
    width: 24px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sequence-btn:hover {
    background-color: #5a6268;
}

.sequence-btn:disabled {
    background-color: #e9ecef;
    border-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

.sequence-btn.up {
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.sequence-btn.down {
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}


.hidden { display: none !important; }
.loading-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
    padding: 16px 20px;
    border-left: 4px solid #3b82f6;
    color: #1f2937;
    font-family: "Times New Roman", Times, serif;
    margin: 0 auto 20px;
    max-width: 600px;
    width: 100%;
}
.loading-card.hidden { display: none !important; }
.loading-card.is-visible {
    display: flex;
}
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.loading-message {
    font-size: 16px;
    color: #1f2937;
    font-weight: 500;
    text-align: center;
}

.error-box {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #d9534f;
    background-color: #f2dede;
    color: #a94442;
    border-radius: 5px;
}
.error-box pre { white-space: pre-wrap; word-wrap: break-word; }

.status-section, .form-section { margin-top: 30px; padding: 20px; background-color: #f8f9fa; border: 1px solid #e3e9ef; border-radius: 6px; box-sizing: border-box; max-width: 100%; overflow: visible; width: 100%; }
.status-section ul { 
    list-style-type: none; 
    padding: 0; 
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}
.status-section li { background-color: #e9f5ff; padding: 8px 12px; border-radius: 4px; margin-bottom: 5px; color: #004085; overflow: visible; }
.icon { margin-right: 8px; }

/* inline action icons for existing forms - align with table Actions column */
/* Match table structure: Form Name | Form OID | Domain | Actions */
.form-list-item { 
    display: flex;
    align-items: center; 
    gap: 12px;
    max-width: 100%; 
    width: 100%;
    box-sizing: border-box;
    padding: 8px 0;
    position: relative;
    overflow: visible;
}
.form-name { 
    min-width: 0; 
    word-wrap: break-word; 
    overflow-wrap: break-word; 
    max-width: 45%;
    flex: 0 1 auto;
    padding-right: 12px;
}
.action-icons { 
    display: inline-flex; 
    align-items: center;
    justify-content: flex-end;
    gap: 6px; 
    flex-shrink: 0;
    flex-wrap: nowrap;
    white-space: nowrap;
    margin-left: auto;
    flex: 0 0 auto;
    min-width: 0;
}
.action-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #334155;
    padding: 4px 6px;
    line-height: 1;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    min-width: 28px;
    height: 28px;
    box-sizing: border-box;
    flex-shrink: 0;
    white-space: nowrap;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 1;
}
.action-icon-btn.annotated-crf {
    padding: 4px 10px;
    min-width: auto;
    width: auto;
    border: 1px solid #6B9DBF;
    outline: none;
    flex-shrink: 0;
    background-color: #ffffff;
    color: #6B9DBF;
    border-radius: 6px;
    font-weight: 500;
    font-size: 12px;
    white-space: nowrap;
    font-size: 10px;
    font-family: "Urbanist", sans-serif;
}
.action-icon-btn.annotated-crf:hover {
    background-color: #f8f9fa;
    color: #6B9DBF;
    border-color: #6B9DBF;
}
.action-icon-btn.annotated-crf:active,
.action-icon-btn.annotated-crf:focus {
    background-color: #ffffff;
    color: #457AA6;
    border-color: #457AA6;
}
.action-icon-btn.crf-specs {
    padding: 2px 12px;
    min-width: auto;
    width: auto;
    border: 1px solid #6B9DBF;
    outline: none;
    flex-shrink: 1;
    background-color: #ffffff;
    color: #6B9DBF;
    border-radius: 8px;
    font-weight: 500;
    font-size: 10px;
    font-family: "Urbanist", sans-serif;
}
.action-icon-btn.crf-specs:hover {
    background-color: #f8f9fa;
    color: #6B9DBF;
    border-color: #6B9DBF;
}
.action-icon-btn.crf-specs:active,
.action-icon-btn.crf-specs:focus {
    background-color: #ffffff;
    color: #457AA6;
    border-color: #457AA6;
}
.action-icon-btn .action-icon-img {
    width: 18px;
    height: 18px;
    display: block;
    object-fit: contain;
}
.action-icon-btn.preview { color: #0c5460; }
.action-icon-btn.edit { color: #5a6268; }
.action-icon-btn.delete { color: #dc3545; }
.action-icon-btn:hover { 
    background-color: #f0f0f0; 
}
/* Override hover for CRF Specifications and Annotated CRF buttons - light background with lighter blue border and text */
.action-icon-btn.crf-specs:hover,
.action-icon-btn.annotated-crf:hover {
    background-color: #f8f9fa !important;
    color: #6B9DBF !important;
    border-color: #6B9DBF !important;
}
/* Active/clicked/selected state: darker blue border and text */
.action-icon-btn.crf-specs:active,
.action-icon-btn.annotated-crf:active,
.action-icon-btn.crf-specs:focus,
.action-icon-btn.annotated-crf:focus,
.action-icon-btn.crf-specs.selected,
.action-icon-btn.annotated-crf.selected {
    background-color: #ffffff !important;
    color: #457AA6 !important;
    border-color: #457AA6 !important;
}

.form-card { border: 1px solid #ddd; border-radius: 6px; padding: 20px; margin-bottom: 20px; background: #fff; }
.form-card label { display: block; margin-bottom: 8px; font-weight: 600; }
.form-card input[type="text"] { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }

.generate-button, .download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-width: 180px;
    margin: 40px auto 0;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: bold;
    font-family: "Urbanist", sans-serif;
    background-color: #28a745;
    border: 1px solid #28a745;
    border-color: #28a745;
    border-radius: 5px;
    color: white;
    box-sizing: border-box;
}

.generate-button:hover, .download-button:hover { background-color: #218838; }

.generate-button img, .download-button img {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

#proceed-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-width: 180px;
    margin: 40px 0 0 auto;
    padding: 10px 24px;
    font-size: 16px;
    background-color: #256527;
    border-color: #256527;
    color: white;
    font-family: "Urbanist", sans-serif;
}

#proceed-btn .button-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

#proceed-btn:hover {
    background-color: #1e4f1f;
}

.preview-area { margin: 20px 0; overflow-x: auto; }
.preview-area textarea {
    width: 100%; /* Changed from 120% to avoid layout overflow */
    height: 400px;
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #2d333b;
    color: #cdd9e5;
    resize: vertical;
    box-sizing: border-box;
}

/* Bigger XML preview area on preview page */
body.preview-page .preview-area textarea {
    height: 70vh; /* responsive tall area */
}

/* Preview page button group - aligned to right */
.preview-button-group {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.preview-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: bold;
    font-family: "Urbanist", sans-serif;
    background-color: #007bff;
    color: white;
    border: 1px solid #007bff;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s;
    width: auto;
    min-width: 180px;
    height: auto;
    box-sizing: border-box;
    margin: 0;
}

.preview-action-btn:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.preview-action-btn:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

.preview-action-btn .btn-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.preview-action-btn .btn-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.preview-action-btn .action-icon-img {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
}

.preview-action-btn .btn-text {
    display: inline-block;
}

.preview-action-btn.validate-btn {
    width: 220px;
}

/* Validation Results Area */
.validation-results {
    margin-top: 25px;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid;
    animation: fadeIn 0.3s ease-in-out;
}

.validation-success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.validation-error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.validation-info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

.validation-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 18px;
}

.validation-header i {
    font-size: 20px;
}

.validation-success .validation-header i {
    color: #28a745;
}

.validation-error .validation-header i {
    color: #dc3545;
}

.validation-info .validation-header i {
    color: #17a2b8;
}

.validation-message {
    font-size: 14px;
    line-height: 1.6;
}

.validation-message pre {
    margin: 0;
    padding: 12px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.validation-error .validation-message pre {
    background-color: rgba(0, 0, 0, 0.08);
}

/* Modal popup for form preview */
#form-preview-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-in-out;
}

#form-preview-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#form-preview-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 90vw;
    max-height: 90vh;
    width: 1000px;
    overflow: hidden;
    position: relative;
    animation: slideIn 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from { 
        transform: scale(0.9);
        opacity: 0;
    }
    to { 
        transform: scale(1);
        opacity: 1;
    }
}

#form-preview-container.hidden {
    display: none;
}

.form-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 2px solid #e5e7eb;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    font-weight: 600;
    font-size: 1.2em;
    color: #1f2937;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#close-preview-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#close-preview-btn:hover {
    background: #dc2626;
}

#close-edit-btn {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

#close-edit-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.form-preview-content {
    padding: 20px;
    overflow-y: auto;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    max-height: calc(90vh - 120px);
}

/* Make preview content scrollable */
.form-preview-content table {
    width: 100%;
    border-collapse: collapse;
}

.form-preview-content table th,
.form-preview-content table td {
    border: 1px solid #dee2e6;
    padding: 8px;
}

/* New Form Section Styles */
.btn-upload {
    background-color: #eff6ff;
    color: #1e40af;
    border: 1px dotted #3b82f6;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: "Urbanist", sans-serif;
    margin-left: 10px;
    transition: all 0.2s ease;
}

.btn-upload:hover {
    background-color: #dbeafe;
    border-color: #2563eb;
    color: #1e3a8a;
}

.btn-save {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 5px;
}

.btn-save:hover {
    background-color: #0056b3;
}

#new-forms-container {
    margin-top: 10px;
}

#new-forms-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

@media (max-width: 768px) {
    #new-forms-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.new-form-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.new-form-card h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 6px;
    font-size: 14px;
}

.new-form-card .form-input-group {
    margin-bottom: 10px;
}

.new-form-card .form-input-group label {
    display: block;
    margin-bottom: 2px;
    font-weight: bold;
    color: #555;
}

.new-form-card .form-input-group[style*="display: flex"] label {
    margin-bottom: 0;
}

.new-form-card .form-input-group input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.new-form-card .form-input-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.new-form-card .form-input-group textarea,
.new-form-card .form-input-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Urbanist', sans-serif;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
}

.new-form-card .form-input-group textarea:focus,
.new-form-card .form-input-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Create Version button hover effect */
#create-version-btn:hover {
    background-color: #28a745 !important;
    color: white !important;
}

/* Create CRF Version Modal */
#create-version-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-in-out;
}

#create-version-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.form-card-header h4 {
    margin: 0;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
    flex: 1;
}

.btn-remove {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
}

.btn-remove:hover {
    background-color: #c82333;
}

.clickable-header {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    background-color: #1D5E90;
    color: white;
    border-radius: 8px;
    padding: 4px 12px;
    margin: 0;
    border: none;
    font-size: 12px;
    font-weight: bold;
    font-family: "Urbanist", sans-serif;
    display: inline-block;
    text-align: center;
    box-shadow: 0 2px 4px rgba(29, 94, 144, 0.2);
}

.clickable-header .icon {
    color: white;
    filter: brightness(0) invert(1);
}

.clickable-header:hover {
    background-color: #175077;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(29, 94, 144, 0.3);
}

.clickable-header:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(29, 94, 144, 0.2);
}

/* Edit Modal Styles */
#form-edit-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

#form-edit-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

#form-edit-container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 96vw;
    max-height: 95vh;
    width: 1450px;
    overflow: hidden;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

#annotated-crf-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-in-out;
}

#annotated-crf-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

#annotated-crf-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 95vw;
    max-height: 95vh;
    width: 1400px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-in-out;
}

.close-crf-btn {
    background: transparent;
    border: none;
    color: #dc3545;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.2s;
}

.close-crf-btn:hover {
    color: #c82333;
}

.edit-modal-content {
    padding: 0;
    max-height: calc(95vh - 60px);
    overflow: hidden;
    overflow-x: hidden;
}

.edit-split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    height: calc(95vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0; /* Prevents grid overflow */
}

.edit-preview-section {
    border-right: 2px solid #e5e7eb;
    padding: 24px 24px 24px 24px;
    overflow-y: visible;
    overflow-x: hidden;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    min-width: 0; /* Prevents grid overflow */
}

.edit-preview-section h4 {
    margin: 0;
    color: #1f2937;
    font-size: 17px;
    font-weight: 700;
    border-bottom: 3px solid #3b82f6;
    padding-bottom: 10px;
    margin-bottom: 18px;
    min-height: 36px;
    display: flex;
    align-items: center;
    line-height: 1.2;
}

.edit-input-section {
    padding: 24px 24px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0; /* Prevents grid overflow */
    overflow-x: hidden;
    border-right: 2px solid #e5e7eb;
}

.edit-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    border-bottom: 3px solid #3b82f6;
    padding-bottom: 10px;
    min-height: 36px;
}

.edit-input-section h4 {
    margin: 0;
    color: #1f2937;
    font-size: 17px;
    font-weight: 700;
    flex: 1;
    display: flex;
    align-items: center;
    line-height: 1.2;
}

.btn-copy-suggestions-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 8px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy-suggestions-icon:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
    color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-copy-suggestions-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.btn-comments-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Urbanist', sans-serif;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.btn-comments-icon:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
    color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-comments-icon-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

.btn-comments-text {
    font-family: 'Urbanist', sans-serif;
    font-size: 14px;
    font-weight: 500;
}

/* Comments Modal Styles */
#comments-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

#comments-modal.show {
    display: flex;
}

.comments-modal-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    background: #ffffff;
}

.comments-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6b7280;
    min-height: 300px;
}

.loading-progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.circular-progress-bar {
    width: 80px;
    height: 80px;
    position: relative;
}

.circular-progress-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circular-progress-background {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 8;
}

.circular-progress-fill {
    fill: none;
    stroke: #3b82f6;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    animation: circular-progress 1.5s ease-in-out infinite;
    transform-origin: center;
}

@keyframes circular-progress {
    0% {
        stroke-dashoffset: 283;
        transform: rotate(-90deg);
    }
    50% {
        stroke-dashoffset: 70;
        transform: rotate(-90deg);
    }
    100% {
        stroke-dashoffset: 283;
        transform: rotate(270deg);
    }
}

.comments-loading p {
    margin: 0;
    font-family: 'Urbanist', sans-serif;
    font-size: 14px;
    color: #6b7280;
    text-align: center;
}

.comments-content-wrapper {
    animation: fadeIn 0.3s ease-in;
}

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

.comments-section {
    margin-bottom: 20px;
}

.comments-section:last-child {
    margin-bottom: 0;
}

.comments-section-title {
    margin: 0 0 12px 0;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Urbanist', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
}

.comments-display-box {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    min-height: auto;
}

.comments-scrollable {
    max-height: 500px;
    overflow-y: auto;
    padding: 4px;
}

.comments-scrollable::-webkit-scrollbar {
    width: 6px;
}

.comments-scrollable::-webkit-scrollbar-track {
    background: #f9fafb;
    border-radius: 3px;
}

.comments-scrollable::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.comments-scrollable::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.comments-empty {
    color: #9ca3af;
    font-style: italic;
    margin: 0;
    font-family: 'Urbanist', sans-serif;
    font-size: 13px;
    text-align: center;
    padding: 12px 0;
}

/* Compact Comment Item Styles */
.comment-item-compact {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
    transition: all 0.15s ease;
    border-left: 3px solid #e5e7eb;
}

.comment-item-compact:hover {
    border-left-color: #3b82f6;
    background: #f8fafc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.comment-item-compact:last-child {
    margin-bottom: 0;
}

.comment-header-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    gap: 12px;
}

.comment-field-info {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.comment-field-name-compact {
    font-family: 'Urbanist', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
}

.comment-field-oid-separator {
    font-family: 'Urbanist', sans-serif;
    font-size: 13px;
    color: #9ca3af;
    font-weight: 400;
}

.comment-field-oid-text {
    font-family: 'Urbanist', sans-serif;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-mark-complete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-mark-complete:hover {
    border-color: #10b981;
    background-color: #f0fdf4;
    transform: scale(1.05);
}

.btn-back-to-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Urbanist', sans-serif;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.btn-back-to-edit:hover {
    border-color: #3b82f6;
    background-color: #eff6ff;
    color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-back-to-edit-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

.btn-back-to-edit-text {
    font-family: 'Urbanist', sans-serif;
    font-size: 14px;
    font-weight: 500;
}

#comments-container-inline {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.btn-mark-complete:active {
    transform: scale(0.95);
}

.mark-complete-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.btn-mark-complete:hover .mark-complete-icon {
    opacity: 1;
    transform: scale(1.1);
}

.comment-text-compact {
    color: #4b5563;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    font-family: 'Urbanist', sans-serif;
    margin: 0;
    padding-top: 4px;
    word-wrap: break-word;
}

.comments-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #d32f2f;
    text-align: center;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.comments-error p {
    margin: 0;
    font-family: 'Urbanist', sans-serif;
    font-size: 14px;
}

/* Comments modal container should match edit modal */
#comments-container {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#comments-container .form-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px 8px 0 0;
}

#comments-container .form-preview-header span {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

#comments-container .form-preview-header button {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#comments-container .form-preview-header button:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.edit-mode-toggle {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    border-color: #9ca3af;
    background-color: #f9fafb;
}

.mode-btn.active {
    border-color: #3b82f6;
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.mode-btn span {
    font-size: 14px;
}

.input-mode-container {
    min-height: 300px;
    display: none;
    flex: 1;
    min-height: 300px;
    overflow-y: visible;
    width: 100%;
    box-sizing: border-box;
}

.input-mode-container.active {
    display: flex;
    flex-direction: column;
}

#edit-prompt {
    flex: 1;
    width: 100%;
    padding: 16px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    resize: vertical;
    min-height: 300px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

#edit-prompt:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Suggestions Display Styles */
.suggestions-display {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    min-width: 0; /* Prevents overflow */
    min-height: 300px;
    width: 100%;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.suggestions-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state-text {
    font-size: 14px;
    line-height: 1.6;
    max-width: 400px;
    margin: 0;
}

.suggestions-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.suggestions-loading p {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

.suggestions-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-text {
    color: #dc2626;
    font-size: 14px;
    line-height: 1.6;
    max-width: 400px;
    margin: 0;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.suggestion-category {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.suggestion-category:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f3f4f6;
}

.category-icon {
    font-size: 20px;
}

.category-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}

.category-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.suggestion-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background-color: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
    transition: all 0.2s ease;
}

.suggestion-item:hover {
    background-color: #f3f4f6;
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.suggestion-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #3b82f6;
    color: #ffffff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
}

.suggestion-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    color: #374151;
    padding-top: 2px;
}

.suggestion-item-bullet {
    border-left: 3px solid #7c3aed;
}

.suggestion-bullet {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7c3aed;
    font-size: 18px;
    font-weight: 600;
    padding-top: 2px;
}

/* Simple editable suggestions list */
.suggestions-list-simple {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}

.suggestion-item-editable {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    transition: all 0.2s ease;
    position: relative;
}

.suggestion-item-editable:hover {
    background-color: #fafafa;
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.suggestion-item-editable:focus-within {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    background-color: #ffffff;
}

.suggestion-bullet-simple {
    flex-shrink: 0;
    color: #7c3aed;
    font-size: 16px;
    font-weight: 700;
    margin-top: 3px;
    line-height: 1.4;
    width: 20px;
    text-align: center;
}

.suggestion-text-editable {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    color: #1f2937;
    min-height: 22px;
    outline: none;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.suggestion-text-editable:focus {
    background-color: #fefefe;
}

.suggestion-text-editable:empty:before {
    content: attr(data-placeholder);
    color: #9ca3af;
    font-style: italic;
}

.suggestion-remove-btn {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background-color: transparent;
    color: #9ca3af;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    opacity: 0;
    margin-top: 1px;
}

.suggestion-item-editable:hover .suggestion-remove-btn {
    opacity: 1;
}

.suggestion-remove-btn:hover {
    background-color: #fee2e2;
    color: #dc2626;
    transform: scale(1.1);
}

.suggestion-remove-btn:active {
    transform: scale(0.95);
}

.suggestion-add-container {
    margin-top: 4px;
    padding: 4px 0;
}

.suggestion-add-btn {
    width: 100%;
    padding: 10px 12px;
    border: 2px dashed #d1d5db;
    background-color: #fafafa;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

.suggestion-add-btn:hover {
    border-color: #7c3aed;
    background-color: #f5f3ff;
    color: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(124, 58, 237, 0.1);
}

.suggestion-add-btn:active {
    transform: translateY(0);
}

.suggestion-add-btn .add-icon {
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
}

.suggestion-add-btn .add-text {
    font-size: 14px;
}


.edit-buttons {
    display: flex;
    gap: 12px;
    margin-top: 0;
}

.edit-buttons button {
    flex: 1;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: "Urbanist", sans-serif;
}

/* Make Changes button - light green background, thin solid green border, dark green text */
.edit-buttons #make-changes-btn.btn-generate {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #10b981;
    box-shadow: none;
}

.edit-buttons #make-changes-btn.btn-generate:hover {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #059669;
    box-shadow: none;
    transform: none;
}

/* Smart Suggest button - light purple background, thin solid purple border, dark purple text */
.edit-buttons #llm-suggestion-btn.btn-regenerate {
    background-color: #faf5ff;
    color: #7c3aed;
    border: 1px solid #a855f7;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.edit-buttons #llm-suggestion-btn.btn-regenerate:hover {
    background-color: #f3e8ff;
    color: #6d28d9;
    border-color: #9333ea;
    box-shadow: none;
    transform: none;
}

.edit-buttons #llm-suggestion-btn.btn-regenerate .smart-suggest-icon {
    filter: none;
}

.edit-buttons #llm-suggestion-btn.btn-regenerate:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    border-color: #d1d5db;
    cursor: not-allowed;
}

/* New form action buttons - same height */
.new-form-card .form-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.new-form-card .form-actions button:not(.btn-generate):not(.btn-upload) {
    flex: 1;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.new-form-card .form-actions .btn-generate,
.new-form-card .form-actions .btn-upload {
    flex: 1;
    min-height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-buttons button:hover:not(#make-changes-btn):not(#llm-suggestion-btn) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.new-form-card .form-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Responsive styles for edit modal */
@media (max-width: 1600px) {
    #form-edit-container {
        width: 95vw;
        max-width: 95vw;
    }
}

@media (max-width: 1400px) {
    #form-edit-container {
        width: 92vw;
        max-width: 92vw;
    }
}

@media (max-width: 1200px) {
    #form-edit-container {
        width: 90vw;
        max-width: 90vw;
    }
    
    .edit-preview-section,
    .edit-input-section {
        padding: 20px;
    }
    
    .edit-preview-section h4,
    .edit-input-section h4 {
        font-size: 16px;
    }
}

@media (max-width: 1024px) {
    #form-edit-container {
        width: 95vw;
        max-width: 95vw;
    }
    
    .edit-split-view {
        grid-template-columns: 1fr;
        height: auto;
        overflow-x: hidden;
    }
    
    .edit-preview-section {
        border-right: none;
        border-bottom: 2px solid #e5e7eb;
        max-height: 45vh;
        padding: 20px;
    }
    
    .edit-input-section {
        padding: 20px;
    }
    
    .edit-preview-section h4,
    .edit-section-header {
        margin-bottom: 15px;
    }
}

@media (max-width: 768px) {
    #form-edit-container {
        width: 98vw;
        max-width: 98vw;
        max-height: 98vh;
    }
    
    .form-preview-header {
        padding: 12px 16px;
        font-size: 1em;
    }
    
    .edit-preview-section,
    .edit-input-section {
        padding: 16px;
    }
    
    .edit-preview-section h4,
    .edit-input-section h4,
    .edit-section-header {
        font-size: 15px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .edit-preview-section {
        max-height: 40vh;
    }
    
    #edit-prompt {
        min-height: 250px;
        font-size: 13px;
        padding: 12px;
    }
    
    .edit-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .edit-buttons button {
        width: 100%;
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .btn-copy-suggestions-icon {
        width: 32px;
        height: 32px;
        padding: 6px;
    }
    
    .btn-copy-suggestions-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .btn-comments-icon {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .btn-comments-icon-img {
        width: 16px;
        height: 16px;
    }
    
    .btn-comments-text {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    #form-edit-container {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .form-preview-header {
        padding: 10px 12px;
        font-size: 0.9em;
    }
    
    .edit-preview-section,
    .edit-input-section {
        padding: 12px;
    }
    
    .edit-preview-section h4,
    .edit-input-section h4,
    .edit-section-header {
        font-size: 14px;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }
    
    .edit-preview-section {
        max-height: 35vh;
    }
    
    #edit-prompt {
        min-height: 200px;
        font-size: 12px;
        padding: 10px;
    }
    
    .edit-buttons button {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .suggestion-category {
        padding: 12px;
    }
    
    .suggestion-item {
        padding: 10px;
        gap: 10px;
    }
    
    .suggestion-text {
        font-size: 13px;
    }
    
    .suggestion-number {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
}

/* Download Dropdown Styles */
.download-dropdown {
    position: relative;
    display: inline-block;
}

.download-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.download-menu.hidden {
    display: none;
}

.download-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

.download-menu-item:last-child {
    border-bottom: none;
}

.download-menu-item:hover {
    background-color: #f9fafb;
    color: #1f2937;
}

.download-menu-item svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    color: #6b7280;
    vertical-align: middle;
}

.download-menu-item:hover svg {
    color: #374151;
}

.download-menu-item span {
    font-size: 14px;
    font-weight: 500;
}

/* View Format Dropdown Styles */
.view-format-dropdown {
    display: inline-block;
}

.view-format-dropdown.corner-dropdown {
    position: absolute;
    top: 0;
    right: 0;
}

.view-format-select {
    padding: 8px 16px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    background-color: #ffffff;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 140px;
}

.view-format-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.view-format-select:hover {
    border-color: #9ca3af;
}

#preview-area .hidden {
    display: none !important;
}

#preview-area textarea,
#preview-area iframe {
    width: 100%;
    height: 70vh;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

/* Amendment Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 560px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    font-family: "Urbanist", sans-serif;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close-btn:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 28px;
}

.amendment-form-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-body .form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-body .form-field label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    font-family: "Urbanist", sans-serif;
}

.modal-body .form-field input,
.modal-body .form-field select {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: "Urbanist", sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #ffffff;
}

.modal-body .form-field input:focus,
.modal-body .form-field select:focus {
    outline: none;
    border-color: #1589AC;
    box-shadow: 0 0 0 3px rgba(21, 137, 172, 0.1);
}

.modal-body .form-field.error input,
.modal-body .form-field.error select {
    border-color: #ef4444;
}

.modal-body .form-field .field-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: -4px;
}

.modal-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.amendment-submit-btn {
    background-color: #1589AC;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(21, 137, 172, 0.25);
    padding: 10px 24px;
    width: auto;
    min-width: 140px;
    height: 40px;
    font-size: 14px;
    font-weight: 700;
    box-sizing: border-box;
    line-height: 1;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.amendment-submit-btn:hover {
    background-color: #127193;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(21, 137, 172, 0.3);
}

.amendment-submit-btn:active {
    transform: translateY(0);
}

.amendment-submit-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.loading-indicator.hidden {
    display: none;
}

.loading-indicator .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: #1589AC;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-indicator .loading-message {
    margin-top: 16px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

.modal-body .error-box {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
}

.modal-body .error-box.hidden {
    display: none;
}

/* Responsive adjustments for modal */
@media (max-width: 640px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 20px 24px;
    }
    
    .modal-title {
        font-size: 20px;
    }
    
    .modal-body {
        padding: 24px;
    }
    
    .amendment-submit-btn {
        width: 100%;
    }
}
