/**
 * iPad-Specific Styles for chAI ML Pipeline
 * 
 * Optimized for touch interaction and iPad screen sizes
 */

/* Base iPad Styles */
.ipad-client {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Touch-optimized buttons */
.ipad-client .btn,
.ipad-client button {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    font-size: 16px;
    touch-action: manipulation;
    cursor: pointer;
}

.ipad-client .btn.touch-active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* iPad Browse Button */
.ipad-browse-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px 25px;
    font-size: 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.ipad-browse-btn:hover,
.ipad-browse-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.ipad-browse-btn.file-selected {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

/* Selected Files Container */
.selected-files-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    margin-top: 20px;
}

.selected-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.selected-file-item .file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.selected-file-item .file-name {
    font-weight: 500;
    color: #333;
}

.selected-file-item .file-size {
    color: #6c757d;
    font-size: 14px;
}

.selected-file-item .remove-file {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.selected-file-item .remove-file:hover {
    background: #c82333;
}

/* iPad Toast Notifications */
.ipad-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #333;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 500;
    z-index: 10000;
    transition: bottom 0.3s ease;
    max-width: 90%;
}

.ipad-toast.show {
    bottom: 30px;
}

.ipad-toast.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.ipad-toast.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.ipad-toast i {
    font-size: 20px;
}

/* Progress Modal */
.ipad-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ipad-modal.show {
    opacity: 1;
    visibility: visible;
}

.ipad-modal .modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    min-width: 350px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.ipad-modal.show .modal-content {
    transform: scale(1);
}

.ipad-modal h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
    text-align: center;
}

.progress-message {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 16px;
}

.progress-bar-container {
    background: #e9ecef;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    width: 0%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.progress-percent {
    text-align: center;
    font-weight: 600;
    color: #667eea;
    font-size: 18px;
}

/* Job Monitor */
.ipad-job-monitor {
    position: fixed;
    bottom: -400px;
    left: 10px;
    right: 10px;
    height: 350px;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
    z-index: 9998;
    transition: bottom 0.3s ease;
    display: flex;
    flex-direction: column;
}

.ipad-job-monitor.show {
    bottom: 0;
}

.monitor-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.monitor-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.job-id {
    color: #667eea;
    font-weight: 600;
}

.job-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    background: #e9ecef;
    color: #666;
}

.job-status.streaming {
    background: #17a2b8;
    color: white;
}

.job-status.success {
    background: #28a745;
    color: white;
}

.job-status.error {
    background: #dc3545;
    color: white;
}

.job-logs {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #f8f9fa;
}

.log-entry {
    margin-bottom: 5px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Results Container */
.ipad-results-container {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-top: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.ipad-results-container h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 22px;
}

.results-summary {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.results-summary p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

.result-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s;
}

.result-file-item:hover {
    background: #f8f9fa;
}

.result-file-item .file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.result-file-item .file-actions {
    display: flex;
    gap: 10px;
}

/* File Modal */
.ipad-file-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ipad-file-modal.show {
    opacity: 1;
    visibility: visible;
}

.ipad-file-modal .modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.ipad-file-modal .modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ipad-file-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.ipad-file-modal .close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ipad-file-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.ipad-file-modal pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Prompt Dialog */
.ipad-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ipad-prompt.show {
    opacity: 1;
    visibility: visible;
}

.ipad-prompt .prompt-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.ipad-prompt h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 22px;
}

.ipad-prompt p {
    margin: 0 0 25px 0;
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

.prompt-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.prompt-buttons .btn {
    min-width: 120px;
}

/* Responsive adjustments for different iPad sizes */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    /* iPad Portrait */
    .ipad-modal .modal-content {
        min-width: 500px;
    }
    
    .ipad-job-monitor {
        left: 20px;
        right: 20px;
        height: 400px;
    }
}

@media screen and (min-width: 1024px) and (max-width: 1366px) {
    /* iPad Landscape */
    .ipad-modal .modal-content {
        min-width: 600px;
    }
    
    .ipad-job-monitor {
        left: 50px;
        right: 50px;
        height: 450px;
    }
    
    .ipad-results-container {
        max-width: 900px;
        margin: 30px auto;
    }
}

/* iPad Pro specific */
@media screen and (min-width: 1366px) {
    .ipad-modal .modal-content {
        min-width: 700px;
    }
    
    .ipad-job-monitor {
        left: 100px;
        right: 100px;
        height: 500px;
    }
    
    .ipad-results-container {
        max-width: 1200px;
        margin: 40px auto;
    }
}

/* Drag and Drop Zone for iPad */
.ipad-client .file-drop-zone {
    border: 3px dashed #667eea;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    background: linear-gradient(135deg, rgba(102,126,234,0.05) 0%, rgba(118,75,162,0.05) 100%);
    transition: all 0.3s ease;
    cursor: pointer;
}

.ipad-client .file-drop-zone.drag-over {
    border-color: #764ba2;
    background: linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.1) 100%);
    transform: scale(1.02);
}

.ipad-client .file-drop-zone i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 15px;
}

/* Disable text selection for UI elements */
.ipad-client .btn,
.ipad-client button,
.ipad-client .modal-header,
.ipad-client .monitor-header {
    -webkit-user-select: none;
    user-select: none;
}

/* Enable text selection for content areas */
.ipad-client .job-logs,
.ipad-client pre,
.ipad-client .modal-body {
    -webkit-user-select: text;
    user-select: text;
}