.collapsible-section {
    margin-bottom: 2rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: #f8f8f8;
    cursor: pointer;
    transition: background-color 0.3s ease;
    user-select: none;
}

.collapsible-header:hover {
    background: #f0f0f0;
}

.collapsible-header.active {
    background: #e8e8e8;
    border-bottom: 1px solid #d0d0d0;
}

.collapsible-title-wrapper {
    flex: 1;
}

.collapsible-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.collapsible-description {
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
    color: #666;
    line-height: 1.5;
}

.collapsible-arrow {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    color: #666;
}

.collapsible-arrow svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.collapsible-header.active .collapsible-arrow {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #fff;
}

.collapsible-content.active {
    max-height: 5000px; /* Increased for poster tool */
    transition: max-height 0.5s ease-in;
}

.collapsible-inner {
    padding: 1.5rem;
}

/* Remove redundant container styling from original converter-container */
.collapsible-content .converter-container {
    border: none;
    box-shadow: none;
    background: none;
    padding: 0;
    margin: 0;
}

.collapsible-content .converter-heading {
    display: none; /* Hide redundant headings inside collapsed content */
}

.collapsible-content .tool-description {
    display: none; /* Hide redundant descriptions inside collapsed content */
}

/* Poster Printer Tool Styles */
.poster-tool {
    padding: 1rem 0;
}

.poster-upload-section {
    background: #f9f9f9;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.poster-upload-section.dragover {
    background: #e8f4ff;
    border-color: #4a90e2;
}

.poster-upload-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.poster-upload-button:hover {
    background: #357abd;
}

.poster-upload-input {
    display: none;
}

.paper-size-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.paper-size-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.poster-preview-section {
    display: none;
    margin: 2rem 0;
}

.poster-preview-section.active {
    display: block;
}

.preview-info {
    background: #f0f7ff;
    border: 1px solid #d0e4ff;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.preview-info p {
    margin: 0.5rem 0;
    color: #333;
}

.size-control {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.size-control-header {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.size-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.size-input-group label {
    flex: 0 0 120px;
    font-size: 0.95rem;
}

.size-input-group input {
    flex: 1;
    max-width: 150px;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
}

.size-input-group span {
    font-size: 0.9rem;
    color: #666;
}

.grid-preview-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.grid-preview-header {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
}

.grid-preview {
    display: inline-block;
    background: #f9f9f9;
    border: 2px solid #333;
    padding: 0;
    position: relative;
    margin-bottom: 1rem; /* Add margin to prevent overlap */
}

.grid-cell {
    border: 1px solid #666;
    box-sizing: border-box;
    display: inline-block;
    vertical-align: top;
    position: relative;
    background-size: cover;
    background-repeat: no-repeat;
}

.grid-cell-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
}

.process-button {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 2rem auto;
    padding: 1rem 2rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.process-button:hover:not(:disabled) {
    background: #218838;
}

.process-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.process-button.processing {
    background: #ffc107;
}

.grid-info {
    background: #fff3cd;
    border: 1px solid #ffecd1;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.grid-info p {
    margin: 0.5rem 0;
    color: #856404;
    font-size: 0.95rem;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .collapsible-header {
        padding: 1rem;
    }

    .collapsible-title {
        font-size: 1.25rem;
    }

    .collapsible-description {
        font-size: 0.9rem;
    }

    .collapsible-inner {
        padding: 1rem;
    }

    .size-input-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .size-input-group label {
        flex: none;
    }

    .size-input-group input {
        max-width: 100%;
    }
}

.value-study-tool {
    padding: 1rem 0;
}

.value-upload-section {
    background: #f9f9f9;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.value-upload-section.dragover {
    background: #e8f4ff;
    border-color: #4a90e2;
}

.value-upload-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.value-upload-button:hover {
    background: #357abd;
}

.value-upload-input {
    display: none;
}

.value-canvas-section {
    display: none;
    margin: 2rem 0;
}

.value-canvas-section.active {
    display: block;
}

.value-canvas-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.value-canvas-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

#valueStudyCanvas {
    max-width: 100%;
    max-height: 80vh;  
    width: auto;       
    height: auto;
    display: block;
    border: 1px solid #ccc;
}

.value-controls {
    background: #f0f7ff;
    border: 1px solid #d0e4ff;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.value-control-group {
    margin-bottom: 1.5rem;
}

.value-control-group:last-child {
    margin-bottom: 0;
}

.value-control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.value-control-value {
    color: #4a90e2;
    font-weight: 700;
}

.value-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.value-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    transition: background 0.3s ease;
}

.value-slider::-webkit-slider-thumb:hover {
    background: #357abd;
}

.value-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    border: none;
    transition: background 0.3s ease;
}

.value-slider::-moz-range-thumb:hover {
    background: #357abd;
}

.value-info {
    background: #fff3cd;
    border: 1px solid #ffecd1;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #856404;
}

.value-reset-button {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
    margin-top: 1rem;
}

.value-reset-button:hover {
    background: #5a6268;
}

.value-export-button {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: #5da36e;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.3s ease;
    margin-bottom: 0.5rem;
}

.value-export-button:hover {
    background: #218838;
}