/**
 * ASC Audio Transcriber - Frontend Styles
 * Version: 1.0.0
 */

.asc-audio-transcriber {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #ffffff;
    border: 1px solid #e1e1e1;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.asc-audio-transcriber h1,
.asc-audio-transcriber h2,
.asc-audio-transcriber h3 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.asc-audio-transcriber h1 {
    font-size: 2.2em;
    margin-bottom: 20px;
}

.asc-audio-transcriber h3 {
    font-size: 1.3em;
    margin-bottom: 15px;
}

.asc-recording-section {
    text-align: center;
    margin: 30px 0;
}

.asc-record-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.asc-record-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
}

.asc-record-btn:active {
    transform: translateY(0);
}

.asc-record-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.asc-record-btn.recording {
    background: #f44336;
    animation: asc-pulse 1s infinite;
    box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
}

@keyframes asc-pulse {
    0% { 
        transform: scale(1); 
        box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
    }
    50% { 
        transform: scale(1.05); 
        box-shadow: 0 6px 12px rgba(244, 67, 54, 0.5);
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 4px 8px rgba(244, 67, 54, 0.3);
    }
}

.asc-status {
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    border-left: 4px solid;
}

.asc-status.info {
    background: #e3f2fd;
    color: #1976d2;
    border-left-color: #2196F3;
}

.asc-status.success {
    background: #e8f5e8;
    color: #2e7d32;
    border-left-color: #4CAF50;
}

.asc-status.error {
    background: #ffebee;
    color: #c62828;
    border-left-color: #f44336;
}

.asc-audio-preview {
    margin: 30px 0;
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.asc-audio-preview h3 {
    margin-top: 0;
    color: #555;
}

.asc-audio-preview audio {
    width: 100%;
    max-width: 500px;
    margin: 15px 0;
    border-radius: 5px;
}

.asc-submit-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
}

.asc-submit-btn:hover {
    background: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.4);
}

.asc-submit-btn:active {
    transform: translateY(0);
}

.asc-submit-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.asc-response-section {
    margin-top: 30px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.asc-response-section h3 {
    margin-top: 0;
    color: #333;
    text-align: left;
}

.asc-response-content {
    background: white;
    padding: 20px;
    border-radius: 5px;
    border-left: 4px solid #2196F3;
    white-space: pre-wrap;
    font-family: 'Courier New', Monaco, monospace;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .asc-audio-transcriber {
        margin: 10px;
        padding: 15px;
    }
    
    .asc-record-btn {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .asc-audio-transcriber h1 {
        font-size: 1.8em;
    }
    
    .asc-response-content {
        font-size: 12px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .asc-audio-transcriber {
        margin: 5px;
        padding: 10px;
    }
    
    .asc-record-btn {
        padding: 10px 16px;
        font-size: 14px;
        width: 100%;
        max-width: 280px;
    }
    
    .asc-submit-btn {
        width: 100%;
        max-width: 280px;
        padding: 12px;
    }
    
    .asc-audio-transcriber h1 {
        font-size: 1.5em;
    }
}

/* WordPress Admin Bar Compatibility */
body.admin-bar .asc-audio-transcriber {
    margin-top: 50px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .asc-audio-transcriber {
        background-color: #2c2c2c;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .asc-audio-transcriber h1,
    .asc-audio-transcriber h2,
    .asc-audio-transcriber h3 {
        color: #e0e0e0;
    }
    
    .asc-audio-preview {
        background: #3c3c3c;
        border-color: #555;
    }
    
    .asc-response-section {
        background: #3c3c3c;
        border-color: #555;
    }
    
    .asc-response-content {
        background: #2c2c2c;
        color: #e0e0e0;
    }
    
    .asc-status.info {
        background: #1a237e;
        color: #bbdefb;
    }
    
    .asc-status.success {
        background: #1b5e20;
        color: #c8e6c9;
    }
    
    .asc-status.error {
        background: #b71c1c;
        color: #ffcdd2;
    }
}

/* Loading Animation */
.asc-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: asc-spin 1s ease-in-out infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes asc-spin {
    to { transform: rotate(360deg); }
}

/* Hide elements by default */
.asc-audio-preview[style*="display: none"],
.asc-response-section[style*="display: none"] {
    display: none !important;
}

/* ========================================
   CF7 Field Styles
   ======================================== */

.asc-audio-field-wrapper {
    margin: 15px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.asc-audio-field-recorder {
    position: relative;
}

.asc-recording-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.asc-record-btn-field,
.asc-stop-btn-field,
.asc-transcribe-btn-field,
.asc-retranscribe-btn-field {
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.asc-record-btn-field {
    background: #4CAF50;
    color: white;
}

.asc-record-btn-field:hover {
    background: #45a049;
}

.asc-stop-btn-field {
    background: #f44336;
    color: white;
    animation: asc-pulse 1s infinite;
}

.asc-stop-btn-field:disabled {
    background: #cccccc;
    cursor: not-allowed;
    animation: none;
}

.asc-transcribe-btn-field {
    background: #2196F3;
    color: white;
    margin-top: 10px;
}

.asc-transcribe-btn-field:hover {
    background: #1976D2;
}

.asc-transcribe-btn-field:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.asc-retranscribe-btn-field {
    background: #FF9800;
    color: white;
    margin-top: 10px;
}

.asc-retranscribe-btn-field:hover {
    background: #F57C00;
}

.asc-field-status {
    margin: 10px 0;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    border-left: 3px solid;
}

.asc-field-status.info {
    background: #e3f2fd;
    color: #1976d2;
    border-left-color: #2196F3;
}

.asc-field-status.success {
    background: #e8f5e8;
    color: #2e7d32;
    border-left-color: #4CAF50;
}

.asc-field-status.error {
    background: #ffebee;
    color: #c62828;
    border-left-color: #f44336;
}

.asc-field-status.recording {
    background: #fff3e0;
    color: #e65100;
    border-left-color: #FF9800;
    animation: asc-pulse-status 1.5s infinite;
}

@keyframes asc-pulse-status {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.asc-field-audio-preview {
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.asc-field-audio-player {
    width: 100%;
    margin: 10px 0;
}

.asc-field-transcription {
    margin: 15px 0;
    padding: 15px;
    background: #e8f5e9;
    border-radius: 5px;
    border-left: 4px solid #4CAF50;
}

.asc-field-transcription label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2e7d32;
}

.asc-transcription-text {
    background: white;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #c8e6c9;
    margin-bottom: 10px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

.asc-transcription-field {
    /* Hidden field - no styles needed but keeping for specificity */
}

/* Responsive for CF7 Fields */
@media (max-width: 768px) {
    .asc-audio-field-wrapper {
        padding: 12px;
    }
    
    .asc-recording-controls {
        flex-direction: column;
    }
    
    .asc-record-btn-field,
    .asc-stop-btn-field,
    .asc-transcribe-btn-field,
    .asc-retranscribe-btn-field {
        width: 100%;
    }
}

/* CF7 Integration */
.wpcf7 .asc-audio-field-wrapper {
    margin: 0 0 1em 0;
}

.wpcf7-form-control-wrap .asc-audio-field-wrapper {
    display: block;
}
