.audio-trim-container,
.audio-trim-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.audio-trim-container {
    max-width: 800px;
    margin: 40px auto 50px;
    padding: 30px;
    background-color: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.progress-view {
    padding: 20px;
}

.progress-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    margin-top: 10px;
}

.progress-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 15px;
}

.progress-container {
    flex-grow: 1;
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    width: 0%;
    background-color: #3498db;
    transition: width 0.2s ease-in-out;
    border-radius: 10px;
}

.progress-percentage-text {
    font-weight: 500;
    margin-left: 15px;
    color: #2c3e50;
}

.animated-loading-text {
    text-align: center;
    font-size: 17px;
    color: #5a6a7a;
    height: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.audio-trim-title {
    text-align: center;
    margin-bottom: 10px;
    color: #2c3e50;
    font-weight: 500;
    font-size: 28px;
}

.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px;
    background-color: white;
    border-radius: 10px;
    border: 2px dashed #3498db;
    transition: all 0.3s ease;
    max-width: 600px;
    margin: 0 auto 30px;
}

.upload-section:hover {
    border-color: #2980b9;
    background-color: #f0f8ff;
}

.upload-icon {
    font-size: 48px;
    color: #3498db;
    margin-bottom: 0;
}

.upload-text {
    margin-bottom: 0;
    color: #34495e;
    font-size: 18px;
}

.upload-text-or {
    margin: 15px 0;
    color: #5a6a7a;
    font-size: 17px;
}

.upload-section p {
    text-align: center;
    margin: 0;
}

.file-input {
    display: none;
}

.upload-btn {
    background-color: #4b6ae5;
    color: white;
    border: 1px solid transparent;
    padding: 9px 13px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 5px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.upload-btn:hover,
.upload-btn:focus {
    background-color: #4b6ae5;
    box-shadow: none;
    border-color: transparent;
    outline: none;
}

.upload-btn:active {
    background-color: #4b6ae5;
    transform: scale(0.98);
    box-shadow: none;
    outline: none;
}

.audio-player-section {
    margin-bottom: 20px;
    background-color: white;
    padding: 5px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.audio-player {
    width: 100%;
    display: none;
    margin-bottom: 15px;
}

.trim-controls {
    margin-bottom: 0;
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.trim-title {
    margin-bottom: 20px;
    color: #2c3e50;
    font-weight: 500;
    font-size: 20px;
}

.trim-range-container {
    margin-bottom: 25px;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #7f8c8d;
    font-size: 14px;
}

.range-slider {
    width: 100%;
    height: 6px;
    appearance: none;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
}

.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: none;
}

.time-inputs {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.time-inputs,
.fade-options {
    flex-wrap: wrap;
}

.time-label {
    display: block;
    margin-bottom: 8px;
    color: #34495e;
    font-weight: 500;
}

.time-input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.audio-trim-container .time-input {
    padding: 10px 12px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    width: var(--time-input-width, 110px);
    text-align: left;
    padding-right: 25px;
}

.audio-trim-container .time-input:hover,
.audio-trim-container .fade-duration-input:hover,
.audio-trim-container .format-select:hover {
    background-color: white;
}

.audio-trim-container .time-input:focus,
.audio-trim-container .fade-duration-input:focus,
.audio-trim-container .format-select:focus {
    background-color: white;
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 1px rgba(52, 152, 219, 0.2);
}

.time-stepper {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
}

.stepper-up {
    margin-bottom: 2px;
}

.stepper-down {
    margin-top: 2px;
}

.audio-trim-container .stepper-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.stepper-btn:hover,
.stepper-btn:focus {
    color: #000;
}

.stepper-btn:active {
    color: #000;
    transform: scale(0.95);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.trim-btn,
.download-btn,
.play-btn,
.reset-btn,
.new-audio-btn {
    padding: 9px 13px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.trim-btn,
.result-actions .download-btn {
    background-color: #198754;
    color: white;
}

.trim-btn:hover,
.trim-btn:focus,
.result-actions .download-btn:hover,
.result-actions .download-btn:focus {
    background-color: #198754;
    box-shadow: none;
    border-color: transparent;
    outline: none;
}

.trim-btn:active,
.result-actions .download-btn:active {
    background-color: #198754;
    transform: scale(0.98);
    box-shadow: none;
    outline: none;
}

.download-btn {
    background-color: #2ecc71;
    color: white;
    padding: 9px 13px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-loader {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.download-btn.loading .btn-loader {
    display: inline-block;
}

.download-btn:hover,
.download-btn:focus {
    background-color: #2ecc71;
    box-shadow: none;
    border-color: transparent;
    outline: none;
}

.download-btn:active {
    background-color: #2ecc71;
    transform: scale(0.98);
    box-shadow: none;
    outline: none;
}

.play-btn {
    background-color: #a26a11;
    color: white;
}

.play-btn:hover,
.play-btn:focus {
    background-color: #a26a11;
    box-shadow: none;
    border-color: transparent;
    outline: none;
}

.play-btn:active {
    background-color: #a26a11;
    transform: scale(0.98);
    box-shadow: none;
    outline: none;
}

.reset-btn {
    background-color: #6d7778;
    color: white;
}

.reset-btn:hover,
.reset-btn:focus {
    background-color: #6d7778;
    box-shadow: none;
    border-color: transparent;
    outline: none;
}

.reset-btn:active {
    background-color: #6d7778;
    transform: scale(0.98);
    box-shadow: none;
    outline: none;
}

.new-audio-btn {
    background-color: #dc3545;
    color: white;
}

.new-audio-btn:hover,
.new-audio-btn:focus {
    background-color: #dc3545;
    box-shadow: none;
    border-color: transparent;
    outline: none;
}

.new-audio-btn:active {
    background-color: #dc3545;
    transform: scale(0.98);
    box-shadow: none;
    outline: none;
}

.result-view {
    padding: 20px;
    text-align: center;
}

.success-icon {
    width: 50px;
    height: 50px;
    color: #27ae60;
    margin-bottom: 0;
}

.result-message {
    font-size: 19px;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 20px;
    margin-top: 20px;
    text-align: center;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.format-select {
    padding: 9px 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    background-color: white;
    cursor: pointer;
    margin-bottom: 15px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8L10 12L14 8' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    background-size: 20px 20px;
    padding-right: 35px;
    margin-bottom: 0;
    /* Removed margin-bottom */
}

.format-option-group,
.quality-options {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.quality-label {
    font-weight: 500;
    color: #34495e;
}

.format-label {
    font-weight: 500;
    color: #34495e;
}

.quality-options .format-select {
    margin-bottom: 0;
    /* Override margin from .format-select */
}

.output-options {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-top: 20px;
    margin-bottom: 0;
}

.hidden {
    display: none;
}

.options-section {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 10px 15px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.options-title {
    margin: 0;
    font-size: 17px;
    font-weight: 500;
}

.options-toggle-icon {
    transition: transform 0.3s ease;
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transform: rotate(0deg);
}

.options-section:not(.collapsed) .options-toggle-icon {
    transform: rotate(180deg);
}

.options-content {
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding-top 0.4s ease-out, margin-top 0.4s ease-out;
    max-height: 1000px;
    /* Large enough value */
    padding-top: 20px;
    margin-top: 10px;
    border-top: 1px solid #e9ecef;
}

.options-section.collapsed .options-content {
    max-height: 0;
    padding-top: 0;
    margin-top: 0;
    border-top: none;
}

.waveform-container {
    width: 100%;
    height: 120px;
    background-color: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 20px;
    margin-top: 25px;
    /* Add space for the time display above */
    position: relative;
}

.waveform {
    width: 100%;
    height: 100%;
}

.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background-color: rgba(52, 152, 219, 0.3);
    pointer-events: none;
}

.selection-region {
    position: absolute;
    top: 0;
    height: 100%;
    background-color: rgba(46, 204, 113, 0.3);
    left: var(--selection-left, 0);
    width: var(--selection-width, 0);
    /* #2ecc71 with opacity */
    pointer-events: none;
}

/* New style for 'cut' mode */
.selection-region.cut-mode {
    background-color: rgba(231, 76, 60, 0.4);
    /* #e74c3c with opacity */
    border-left: 2px dashed #c0392b;
    border-right: 2px dashed #c0392b;
    box-sizing: border-box;
}

#selectionDurationDisplay {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    z-index: 11;
    pointer-events: none;
}

#currentTimeDisplay {
    position: absolute;
    top: -22px;
    /* Position it above the waveform container */
    left: var(--current-time-left, 0);
    transform: translateX(-50%);
    /* Center it on the progress line */
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    z-index: 11;
    pointer-events: none;
}

.marker-time-display {
    position: absolute;
    bottom: -22px;
    /* Position it below the waveform container */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    pointer-events: none;
    white-space: nowrap;
}

.marker-time-display.outside-start {
    left: auto;
    right: 50%;
    transform: none;
}

.marker-time-display.outside-end {
    left: 50%;
    right: auto;
    transform: none;
}

.trim-marker {
    position: absolute;
    top: 0;
    height: 100%;
    left: var(--marker-left, 0);
    width: 10px;
    /* Wider for easier grabbing */
    cursor: ew-resize;
    /* East-West resize cursor */
    z-index: 10;
}

.trim-marker::after {
    content: '';
    position: absolute;
    top: 0;
    left: 3.5px;
    /* Centered in the 10px width */
    width: 3px;
    /* Increased thickness for better visibility */
    background-color: #e74c3c;
    height: 100%;
}

#progress-indicator {
    position: absolute;
    top: 0;
    left: var(--marker-left, 0);
    height: 100%;
    background-color: white;
    width: 1px;
    /* Make it a single thin line */
    z-index: 9;
    /* Below the trim markers */
    pointer-events: none;
}

.processing-options {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-bottom: 20px;
}

.processing-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 16px;
    color: #34495e;
}

.processing-options input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: #3498db;
}

.fade-options {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.fade-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
    color: #34495e;
}

.audio-trim-container .fade-duration-input {
    width: 50px;
    padding: 9px 2px;
    border: 1px solid #ddd;
    background-color: #fff;
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
}

/* Hides spinners from number inputs */
.fade-duration-input {
    appearance: textfield;
    -moz-appearance: textfield;
}

.fade-duration-input::-webkit-inner-spin-button,
.fade-duration-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.faq-list {
    margin-top: 1rem;
}

.faq-list dt {
    font-weight: 500;
    font-size: 1.1em;
}

.faq-list dd {
    margin-left: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    padding-bottom: 10px;
    border-bottom: 1px dashed #ddd;
}

@media (max-width: 767px) {
    .audio-trim-container {
        padding: 15px 0;
        margin: 0 auto 60px;
        border-radius: 0;
        box-shadow: none;
        border-top: 1px solid #e0e0e0;
        border-bottom: 1px solid #e0e0e0;
    }

    .upload-section,
    .result-view {
        padding-left: 15px;
        padding-right: 15px;
    }

    .trim-controls {
        padding-left: 0;
        padding-right: 0;
        padding-top: 0;
    }

    .result-view {
        padding-left: 15px;
        padding-right: 15px;
    }

    .waveform-container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .processing-options {
        flex-direction: column;
        gap: 8px;
    }

    .trim-btn,
    .download-btn,
    .play-btn,
    .reset-btn,
    .new-audio-btn {
        padding: 8px;
    }

    .output-options {
        flex-direction: column;
        gap: 0;
        padding-top: 15px;
    }

    .time-inputs,
    .fade-options {
        justify-content: flex-start;
    }

    .options-section {
        padding: 10px 8px;
    }
}