/* --- AudioMate Specific Styles (Based on Loudness Analyzer Dark Theme) --- */
.tool-wrapper {
    background-color: #2b2b2b;
    color: #e0e0e0;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

.tool-header {
    background: #1f1f1f;
    padding: 15px 25px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-title {
    font-weight: bold;
    font-size: 1.1rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.version-badge {
    background: #ff5252;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    letter-spacing: 1px;
}



/* Drop Zone */
.drop-zone {
    padding: 60px 20px;
    background: #2b2b2b;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    border: 2px dashed #444;
    margin: 20px;
    border-radius: 12px;
}

.drop-zone:hover,
.drop-zone.dragover {
    background: #333;
    border-color: var(--primary-color);
    box-shadow: inset 0 0 20px rgba(0, 174, 239, 0.1);
}

.drop-icon {
    font-size: 3.5rem;
    color: #666;
    margin-bottom: 20px;
    transition: 0.3s;
}

.drop-zone:hover .drop-icon {
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Workspace Area */
.workspace {
    padding: 20px;
    display: none;
    /* Hidden by default until file loaded */
    height: 100%;
    flex-direction: column;
    flex: 1;
}

/* Functional Panels */
.panel {
    display: none;
    animation: fadeIn 0.3s;
}

.panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 1. Converter UI */
.convert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.control-group {
    background: #222;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #444;
}

.control-label {
    display: block;
    color: #aaa;
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: bold;
}

.dark-select {
    width: 100%;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 10px;
    border-radius: 6px;
    font-size: 1rem;
}

/* 2. Editor UI (Waveform) */
/* Wavesurfer v7 Shadow DOM styling for iPhone-style Trim Handles */

/* Wrapper overall background (Outside area - Corrected to be Black) */
#waveform ::part(wrapper) {
    background-color: #000;
}

/* Selection background (Inside area) */
#waveform ::part(progress) {
    background-color: transparent !important;
    display: block !important;
    z-index: 1;
}

/* Waveform inside selection must be visible */
#waveform ::part(progress)>div {
    position: relative;
}

/* Region overlay - Uses box-shadow to create a semi-transparent mask for the outside */
#waveform ::part(region) {
    box-shadow: 0 0 0 10000px rgba(0, 0, 0, 0.7) !important;
    /* This grays out the outside area while still showing the waveform */
    border: 2px solid #ffd700 !important;
    background-color: transparent !important;
    border-radius: 4px;
    box-sizing: border-box;
    z-index: 10;
    cursor: default !important;
}

/* Thick Gold Handles (Ensuring high visibility and ease of grabbing) */
#waveform ::part(region-handle) {
    width: 20px !important;
    /* Increased for better touch/click */
    background-color: #ffd700 !important;
    opacity: 0.4 !important;
    z-index: 30 !important;
    /* Above everything */
    cursor: ew-resize !important;
}

#waveform ::part(region-handle-left) {
    border-radius: 4px 0 0 4px;
}

#waveform ::part(region-handle-right) {
    border-radius: 0 4px 4px 0;
}

/* iPhone-style grip lines on handles */
#waveform ::part(region-handle)::after {
    content: "" !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 2px !important;
    height: 24px !important;
    background: rgba(0, 0, 0, 0.5) !important;
    border-radius: 1px !important;
    box-shadow: 4px 0 rgba(0, 0, 0, 0.5), -4px 0 rgba(0, 0, 0, 0.5) !important;
}

.waveform-container {
    background: #000;
    border-radius: 12px;
    border: 1px solid #444;
    position: relative;
    margin-bottom: 30px;
    /* Height adjusted to accommodate Minimap (50px) + Main Waveform (250px) + Padding */
    height: 340px;
    padding: 10px 0;
    overflow: hidden !important;
    /* Important for the blackout mask */
    display: flex;
    flex-direction: column;
}

#waveform {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Minimap specific styling */
#minimap-container {
    height: 50px;
    width: 100%;
    background-color: #1a1a1a;
    border-bottom: 2px solid #333;
    margin-bottom: 15px;
    position: relative;
    /* Context for Viewport */
    cursor: pointer;
}

/* ミニマップの波形部分のポインターイベントを無効化（ビューポートのドラッグを優先） */
/* WaveSurferが生成する波形コンテナのみを対象とし、ビューポートには影響しない */
#minimap-container>div:not(.minimap-viewport) {
    pointer-events: none;
}

/* Hide the default overlay inside the minimap shadow DOM (if approachable) or via this mechanism if it exposes parts from the custom container */
#minimap-container::part(minimap-overlay) {
    display: none !important;
}

/* Also target generic usage just in case */
#waveform ::part(minimap) {
    display: none !important;
    /* Hide defaults if they appear */
}

/* Viewport Indicator [ ] */
.minimap-viewport {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    z-index: 100 !important;
    cursor: grab;
    box-sizing: border-box;
    border-left: 2px solid #fff;
    border-right: 2px solid #fff;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    transition: background 0.2s;
    pointer-events: auto;
    /* Essential for dragging */
}

.minimap-viewport:hover {
    background: rgba(255, 255, 255, 0.2);
}

.minimap-viewport.grabbing {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.3);
}

/* Time Display Bar */
.time-display-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    margin-bottom: 15px;
    font-family: 'Roboto Mono', monospace;
    background: #1f1f1f;
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid #333;
    flex-wrap: wrap;
}

.time-io-group {
    display: flex;
    gap: 25px;
    align-items: center;
}

@media (max-width: 600px) {
    .time-current-group {
        width: 100%;
        justify-content: center;
        border-bottom: 1px dashed #333;
        padding-bottom: 10px;
        margin-bottom: 5px;
    }
}

.time-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-label {
    font-size: 0.75rem;
    font-weight: bold;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.time-value {
    font-size: 1.1rem;
    color: #fff;
    font-weight: bold;
}

.time-value.now {
    color: #fff;
}

.time-value.in {
    color: #4FD1FF;
}

.time-value.out {
    color: #FF5252;
}

.time-sep {
    color: #444;
    font-weight: normal;
}

.editor-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.tool-btn {
    background: #333;
    color: #eee;
    border: 1px solid #555;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

.tool-btn:hover {
    background: #444;
    border-color: #777;
}

.tool-btn.primary {
    background: var(--primary-color);
    border: none;
    color: #fff;
}

.tool-btn.primary:hover {
    background: var(--primary-hover);
}

.tool-btn.danger {
    background: #ff5252;
    border: none;
    color: #fff;
}

.zoom-slider {
    width: 150px;
    accent-color: var(--primary-color);
}



/* Action Footer */
.action-footer {
    margin-top: auto;
    border-top: 1px solid #444;
    padding-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.process-btn {
    background: var(--primary-color);
    color: #fff;
    font-weight: bold;
    border: none;
    padding: 12px 40px;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 174, 239, 0.3);
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.process-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 174, 239, 0.4);
}

/* File Info Bar */
.file-info-bar {
    background: #2196f3;
    color: white;
    padding: 8px 15px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-name {
    font-weight: bold;
    font-family: 'Roboto Mono';
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .tool-title {
        font-size: 0.9rem;
    }
}

.seo-content h2 {
    font-size: 1.8rem;
    color: var(--text-main);
    margin-top: 50px;
    margin-bottom: 25px;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
}

.seo-content h3 {
    font-size: 1.4rem;
    color: var(--text-main);
    margin-top: 30px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.seo-content h3 i {
    color: var(--primary-color);
}

.seo-content p {
    margin-bottom: 1.5em;
    line-height: 1.8;
    color: #444;
}

.seo-content ul {
    background: #f9f9f9;
    padding: 20px 20px 20px 40px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid #eee;
}

.seo-content li {
    margin-bottom: 10px;
    list-style-type: disc;
    color: #444;
}

.feature-grid-seo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.feature-item {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.feature-item h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    margin-top: 0;
    border: none;
}

.feature-item p {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
    margin: 0;
}

#seek-notification {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(33, 150, 243, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 2s ease-out;
    z-index: 1000;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    font-weight: 500;
}

.show-notification {
    opacity: 1 !important;
    transition: none !important;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #444;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Hero Section Customizations (Overriding base.css) */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.05),
        0 1px 3px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transform: rotate(-3deg) translateY(0);
    animation: floatCard 6s ease-in-out infinite;
    max-width: 320px;
}

@keyframes floatCard {

    0%,
    100% {
        transform: rotate(-3deg) translateY(0);
    }

    50% {
        transform: rotate(-3deg) translateY(-15px);
    }
}

.hero-visual {
    perspective: 1000px;
}

.card-icon-row {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.card-icon-box {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #fff, #f0f9ff);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    color: var(--primary-color);
    box-shadow:
        0 10px 20px rgba(0, 174, 239, 0.15),
        inset 0 -2px 5px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-icon-box:hover {
    transform: scale(1.1) rotate(5deg);
}

.visual-waveform {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 40px;
    margin: 10px 0;
}

.v-bar {
    width: 6px;
    background: var(--primary-color);
    border-radius: 4px;
    animation: waveAnim 1s ease-in-out infinite alternate;
}

@keyframes waveAnim {
    0% {
        height: 20%;
        opacity: 0.5;
    }

    100% {
        height: 100%;
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .hero-visual {
        display: none;
    }
}