/* ========================================
   Radio SHOCK - Стили для студии звукозаписи
   ======================================== */

/* Базовые стили */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Контейнер */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 15px;
}

/* Шапка */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.header h1 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
}

.header p {
    margin: 5px 0;
    opacity: 0.9;
    font-size: 14px;
}

.header a {
    color: #ffd700;
    text-decoration: none;
    word-break: break-all;
    transition: color 0.3s;
}

.header a:hover {
    color: #ffe44d;
    text-decoration: underline;
}

.logout-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s, transform 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Панель управления */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

/* Кнопки */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    flex: 0 1 auto;
    min-width: 120px;
    -webkit-tap-highlight-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
    transform: scale(0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
    box-shadow: none;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

/* Анимация записи */
.btn.recording {
    animation: pulse 1.5s infinite;
    background: #dc3545;
}

/* Индикатор готовности микрофона */
.btn-primary[data-ready="true"] {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.4);
}

.btn-primary[data-ready="true"]::before {
    content: '●';
    color: #28a745;
    font-size: 16px;
    font-weight: bold;
    margin-right: 8px;
    animation: blink-ready 2s infinite;
    text-shadow: 0 0 5px rgba(40, 167, 69, 0.8);
}

@keyframes blink-ready {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.btn-primary[data-ready="false"] {
    opacity: 0.7;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

.recording-timer {
    font-size: 14px;
    margin-left: 8px;
    font-weight: normal;
    opacity: 0.9;
}

/* Секция загрузки */
.upload-section {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Выбор микрофона */
.microphone-select-container {
    background: white;
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.microphone-select-container label {
    font-weight: 600;
    color: #333;
    font-size: 16px;
    white-space: nowrap;
}

.microphone-select {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s;
    outline: none;
}

.microphone-select:hover {
    border-color: #667eea;
}

.microphone-select:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.microphone-select option {
    padding: 10px;
}

.upload-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-input-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.file-input-wrapper input[type="file"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    background: #f9f9f9;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s;
}

.file-input-wrapper input[type="file"]:hover {
    border-color: #667eea;
    background: #f0f0ff;
}

/* Аудио плеер */
.audio-player-section {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.audio-player-section audio {
    width: 100%;
    border-radius: 30px;
    outline: none;
}

.audio-player-section audio:focus {
    outline: 2px solid #667eea;
}

/* Плейлист */
.playlist {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    min-height: 150px;
}

.playlist:empty::before {
    content: "🎵 Добавьте записи или загрузите файлы";
    display: block;
    text-align: center;
    padding: 50px 20px;
    color: #999;
    font-style: italic;
    font-size: 14px;
}

/* Элемент плейлиста */
.smart {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    margin: 10px 0;
    background: #f8f9fa;
    border-radius: 12px;
    cursor: move;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    -webkit-user-select: none;
    user-select: none;
}

.smart:first-child {
    margin-top: 0;
}

.smart:last-child {
    margin-bottom: 0;
}

.smart:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.smart.ui-sortable-helper {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: rotate(1deg) scale(1.02);
    background: white;
    border-color: #667eea;
}

.smart.ui-sortable-placeholder {
    visibility: visible !important;
    background: #e0e7ff;
    border: 2px dashed #667eea;
    border-radius: 12px;
    height: 70px;
}

.smart b {
    min-width: 30px;
    color: #666;
    font-weight: 600;
}

.smart span {
    font-size: 70%;
    color: #666;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smart .player {
    flex: 1;
    height: 40px;
    min-width: 200px;
}

.smart .del {
    background: #dc3545;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.smart .del:hover {
    background: #c82333;
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(220, 53, 69, 0.3);
}

.smart .del:active {
    transform: scale(0.95);
}

/* Статус сообщения */
.status {
    padding: 15px 20px;
    border-radius: 12px;
    margin: 15px 0;
    display: none;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status.show {
    display: block;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.status.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.status h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.status p {
    margin: 5px 0;
}

.status audio {
    width: 100%;
    margin: 10px 0;
}

.status .btn-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.status .btn-group form {
    flex: 1;
    min-width: 120px;
}

.status .btn-group .btn {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
}

/* Прогресс бар */
.progress-container {
    margin: 15px 0;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 12px;
    transition: width 0.3s ease;
    width: 0%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

/* Оверлей загрузки */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    background: white;
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner p {
    color: #333;
    font-size: 16px;
    margin: 0;
    font-weight: 500;
}

/* Подвал */
.footer {
    text-align: center;
    padding: 30px 20px 20px;
    color: #999;
    font-size: 13px;
}

.footer a {
    color: #667eea;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Форма входа */
.login-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    animation: fadeInScale 0.3s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
}

.login-logo p {
    color: #666;
    font-size: 14px;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
    text-align: center;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s, background 0.3s;
    background: #fafafa;
}

.login-form input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-form button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.login-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.login-form button:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    color: #999;
    font-size: 12px;
}

/* Мобильная адаптация */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 16px;
        min-width: 100px;
    }

    .controls {
        gap: 8px;
    }

    .upload-section,
    .audio-player-section,
    .playlist {
        padding: 15px;
    }

    .smart {
        flex-wrap: wrap;
        padding: 12px;
    }

    .smart .player {
        width: 100%;
        order: 3;
        margin-top: 10px;
        min-width: auto;
    }

    .smart .del {
        margin-left: auto;
    }

    .smart span {
        white-space: normal;
        word-break: break-word;
    }

    .login-container {
        padding: 30px 20px;
    }

    .login-logo h1 {
        font-size: 24px;
    }

    .login-form input {
        padding: 12px;
    }

    .login-form button {
        padding: 12px;
    }
}

@media (max-width: 400px) {
    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .status .btn-group {
        flex-direction: column;
    }

    .status .btn-group form {
        width: 100%;
    }
}

/* Утилиты */
.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-10 {
    gap: 10px;
}

.w-full {
    width: 100%;
}

/* Анимации для перетаскивания */
.drag-over {
    border-color: #667eea !important;
    background: #f0f0ff !important;
}

/* Подсказки */
.tooltip {
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    margin-bottom: 5px;
    pointer-events: none;
}

/* Информация о выбранном файле */
.file-info {
    margin-top: 10px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: 8px;
    font-size: 12px;
    color: #555;
}

.file-info small {
    display: block;
    line-height: 1.6;
}

/* Кнопка создания с счетчиком */
#btn-create-program {
    position: relative;
}

#btn-create-program::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #dc3545;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

#btn-create-program.has-items::after {
    opacity: 1;
}

/* Кнопка новой программы */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#final-result .btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#final-result .btn {
    padding: 12px 16px;
    font-size: 14px;
}

.status.show {
    display: block !important;
}

#final-result {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Стили для SortableJS */
.smart-ghost {
    opacity: 0.5;
    background: #c8ebfb;
    border: 2px dashed #667eea;
}

.smart-drag {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    transform: rotate(1deg);
    z-index: 9999;
}

.smart {
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

.smart:active {
    cursor: grabbing;
}

/* ========================================
   Аудио визуализатор
   ======================================== */

.recording-visualizer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.visualizer-container {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px;
    border-radius: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 90%;
    width: 600px;
}

.recording-indicator {
    width: 60px;
    height: 60px;
    background: #ff0000;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: pulse-red 1.5s infinite;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

@keyframes pulse-red {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 20px rgba(255, 0, 0, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

.recording-timer {
    font-size: 48px;
    font-weight: bold;
    color: #ffffff;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.level-meter-container {
    width: 100%;
    height: 20px;
    background: #2a2a4a;
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.level-meter {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff00 0%, #00ff00 70%, #ffff00 85%, #ff0000 100%);
    transition: width 0.1s ease;
    border-radius: 10px;
}

.level-text {
    color: #ffffff;
    font-size: 14px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
}

/* Мобильная адаптация визуализатора */
@media (max-width: 600px) {
    .visualizer-container {
        padding: 20px;
        max-width: 95%;
    }
    
    .recording-indicator {
        width: 50px;
        height: 50px;
    }
    
    .recording-timer {
        font-size: 36px;
    }
    
    #visualizer-canvas {
        height: 100px;
    }
}