/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    color: white;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    position: relative;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .app-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card h2 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.upload-area:hover, .upload-area.dragover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.upload-area.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.file-input {
    display: none;
}

.loading {
    margin-top: 20px;
}

.progress-bar {
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    border-radius: 10px;
    will-change: width;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.cancel-button {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s;
}

.cancel-button:hover {
    background: #d32f2f;
}

.server-status {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
}

.server-online {
    background: rgba(76, 175, 80, 0.3);
    border: 1px solid rgba(76, 175, 80, 0.5);
}

.server-offline {
    background: rgba(255, 152, 0, 0.3);
    border: 1px solid rgba(255, 152, 0, 0.5);
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="number"] {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

input[type="checkbox"] {
    margin-right: 8px;
}

.bar-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.bar-selection .form-group {
    margin-bottom: 20px;
}

#player-container {
    height: auto;
}

.bar-selection input {
    flex: 1;
}

.bar-selection label {
    margin-bottom: 8px;
    display: block;
}

.results {
    display: none;
    margin-top: 20px;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.result-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 5px;
}

.result-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.result-value {
    font-size: 1.1rem;
    font-weight: bold;
}

.bars-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    padding: 10px;
}

.bar-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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


.section-player {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.action-button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.action-button:hover {
    background: #1976D2;
}

.action-button:disabled {
    background: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

.init-progress {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.init-complete {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    margin-top: 15px;
    display: none;
}

/*Styles AudioStretchPlayer*/
.audio-stretch-player {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: visible;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.play-stop-btn {
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    font-size: 16px;
    flex-shrink: 0;
}

.play-stop-btn:hover {
    background: #1976D2;
}

.playback-slider-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.playback-slider {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    min-width: 0;
}

.playback-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    border: 2px solid white;
}

.playback-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2196F3;
    cursor: pointer;
    border: 2px solid white;
}

.time-display {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    min-width: 45px;
    text-align: center;
    flex-shrink: 0;
}


.controls-panel {
    flex: 1;
    display: flex;
    flex-direction: column; /* <-- stack rows vertically */
    align-items: flex-start;
    gap: 12px; /* spacing between rows */
    width: 100%;
}

.control-row {
    display: flex;
    flex-direction: column; /* Label on line 1, slider+number on line 2 */
    gap: 6px;
    width: 100%;
}

.control-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.control-input-line {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.control-slider {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    min-width: 0;
}

.control-input {
    min-width: 70px;
    max-width: 70px;
    flex-shrink: 0;
}

.control-slider.blue::-webkit-slider-thumb {
    background: #2196F3;
}

.control-slider.red::-webkit-slider-thumb {
    background: #FF9800;
}

.control-slider.blue::-moz-range-thumb {
    background: #2196F3;
}

.control-slider.red::-moz-range-thumb {
    background: #FF9800;
}

.control-input:focus {
    outline: none;
    border-color: #2196F3;
}


.hidden {
    display: none !important;
}

.file-input {
    display: none;
}

/* Header with info button */
.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: relative;
}


/* Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.info-popup-content {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f);
    border-radius: 15px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: popupFadeIn 0.3s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.info-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
}


.info-popup-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-button {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.info-popup-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.info-popup-body p {
    margin-bottom: 15px;
    line-height: 1.5;
}

.info-popup-body ul {
    margin: 15px 0;
    padding-left: 20px;
}

.info-popup-body li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.popup-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

/* Show popup when active */
.popup-overlay.active {
    display: flex;
}

/* Responsive design for popup */
@media (max-width: 600px) {
    .info-popup-content {
        width: 95%;
        margin: 20px;
    }

    .info-popup-body {
        padding: 20px;
    }

    .info-popup-header {
        padding: 15px;
    }

    .info-popup-header h2 {
        font-size: 1.3rem;
    }
}


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

.header-top h1 {
    margin-bottom: 0; /* Remove the previous margin */
    flex: 1;
    text-align: center; /* Keep title centered */
}

/* Info Button Styles */
.menu-button {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.3s ease;
}

.dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: white;
    transition: all 0.3s ease;
}

.menu-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.menu-button:hover .dot {
    background: #fff;
}

.tech-details {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.info-popup-body a {
    color: #64b5f6;
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
}

.info-popup-body a:hover {
    color: #90caf9;
    border-bottom-color: #90caf9;
    text-shadow: 0 0 8px rgba(144, 202, 249, 0.3);
}

.info-popup-body a:active {
    color: #42a5f5;
    transform: translateY(1px);
}

.info-popup-body a:focus {
    outline: 2px solid rgba(100, 181, 246, 0.5);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Specific styles for tech links */
.tech-details a {
    color: #4db6ac;
    font-weight: 500;
}

.tech-details a:hover {
    color: #80cbc4;
    border-bottom-color: #80cbc4;
    text-shadow: 0 0 8px rgba(128, 203, 196, 0.3);
}

/* Ensure links are visible in the dark theme */
.info-popup-body strong {
    color: #fff;
}

.tech-details strong {
    color: #e3f2fd;
}

/* Smooth scrolling for better user experience */
.info-popup-body {
    scroll-behavior: smooth;
}

/* Responsive link styles */
@media (max-width: 600px) {
    .info-popup-body a {
        padding-bottom: 2px;
    }

    .info-popup-body a:focus {
        outline-offset: 1px;
    }
}

/* Button Input Group Styles */
.button-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
    height: 40px; /* Match input field height */
}

.button-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.choice-button {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex: 1;
}

.choice-button.note {
    font-size: 1.5rem;
    font-family: system-ui;
}

.choice-button#countIn {
    max-width: 35px;
}

.count-in-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.count-in-number {
    position: absolute;
    margin-top: -0.5em;
    text-align: center;
    font-size: 22px;
}

.choice-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.choice-button.active {
    background: rgba(0, 0, 0, 0.2);
    outline: 2px solid rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.1);
    color: white;
}

.custom-input {
    width: 70px;
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: transparent !important; /* hide actual text */
    position: relative;
    min-width: 35px;
}


.custom-input.active {
    background: rgba(0, 0, 0, 0.2);
    outline: 2px solid rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.1);
    color: white !important;
}

.custom-input:focus {
    outline: none;
    border-color: #2196F3;
    color: white !important;
}

#prevBar, #nextBar {
    background: #2196F3 !important;
    border: none;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
    height: 40px; /* Match other inputs */
}

#prevBar:hover, #nextBar:hover {
    background: #1976D2 !important;
}

/* Info Menu Styles */
.app-menu {
    animation: menuFadeIn 0.2s ease-out;
    position: absolute;
    background: linear-gradient(135deg, rgba(26, 42, 108, 0.95), rgba(178, 31, 31, 0.95));
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: none;
    z-index: 9999;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.app-menu.active {
    display: block;
}

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

.app-menu .menu-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.app-menu .menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.app-menu .menu-item:active {
    background: rgba(255, 255, 255, 0.2);
}

/* Recent Files Menu Styles */
.recent-files-content {
    animation: popupFadeIn 0.3s ease-out;
    position: fixed;
    background: linear-gradient(135deg, rgba(26, 42, 108, 0.98), rgba(178, 31, 31, 0.98));
    border-radius: 15px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1001;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.recent-files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2)
}

.recent-files-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: white;
}

.recent-files-body {
    text-align: center;
    padding: 40px 20px;
    opacity: 0.8;
}

.recent-file-item {
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
}

.recent-file-item:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-1px);
}

.remove-recent-file {
    transition: all 0.3s ease !important;
    border: 1px solid rgba(244, 67, 54, 0.3) !important;
    background: rgba(244, 67, 54, 0.3);
    color: white;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.8rem;
}

.remove-recent-file:hover {
    background: rgba(244, 67, 54, 0.6) !important;
    border-color: rgba(244, 67, 54, 0.6) !important;
    transform: scale(1.05);
}

.close-recent-menu {
    transition: all 0.3s ease !important;
    border-radius: 50% !important;
    width: 35px !important;
    height: 35px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
}

.close-recent-menu:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.1);
}


/* Responsive design for menus */
@media (max-width: 600px) {
    .app-menu {
        right: 0 !important;
        left: auto !important;
        min-width: 180px !important;
        top: 45px !important;
    }

    .recent-files-content {
        width: 95% !important;
        margin: 10px;
    }

    .menu-button {
        width: 36px;
        height: 36px;
    }
}

/*!* Menu backdrop *!*/
/*.menu-backdrop {*/
/*    position: fixed;*/
/*    top: 0;*/
/*    left: 0;*/
/*    width: 100%;*/
/*    height: 100%;*/
/*    background: transparent;*/
/*    z-index: 9998;*/
/*    display: none;*/
/*}*/