/**
 * CleanSheet Frontend Styles - Fixed Browser Compatibility
 * Apple-inspired design for public shortcode interface
 * Compatible with older browsers, no warning triangles
 */

/* Reset and Base Styles for CleanSheet Container */
.cleansheet-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa;
    border-radius: 20px;
    padding: 32px;
    margin: 32px 0;
    color: #1d1d1f;
    line-height: 1.6;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

/* Header Section */
.cleansheet-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px;
    margin: -32px -32px 32px -32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: 20px 20px 0 0;
}

.cleansheet-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.cleansheet-logo-section {
    display: flex;
    align-items: center;
}

.cleansheet-logo {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 32px;
    color: white;
    margin-right: 20px;
}

.cleansheet-header-text h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.cleansheet-tagline {
    margin: 8px 0 0 0;
    font-size: 16px;
    opacity: 0.9;
    font-weight: 400;
}

/* Progress Indicator */
.cleansheet-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 32px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.cleansheet-progress-step {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 500;
    margin: 0 12px;
}

.cleansheet-progress-step.active {
    color: white;
}

.cleansheet-progress-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-right: 8px;
}

.cleansheet-progress-step.active .cleansheet-progress-number {
    background: white;
    color: #667eea;
}

.cleansheet-progress-divider {
    width: 40px;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1px;
}

/* Main Content Layout */
.cleansheet-main-content {
    display: block;
}

/* Section Styles */
.cleansheet-section {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.cleansheet-section:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.cleansheet-section-header {
    margin-bottom: 32px;
    text-align: center;
}

.cleansheet-section-header h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: -0.5px;
}

.cleansheet-section-header p {
    margin: 0;
    font-size: 16px;
    color: #6e6e73;
    max-width: 600px;
    margin: 0 auto;
}

/* Upload Area */
.cleansheet-upload-area {
    border: 3px dashed #c7c7cc;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.cleansheet-upload-area:hover {
    border-color: #007aff;
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.1);
}

.cleansheet-upload-area.dragover {
    border-color: #34c759;
    background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
    transform: scale(1.02);
}

.cleansheet-upload-icon {
    font-size: 48px;
    color: #007aff;
    margin-bottom: 20px;
    display: block;
}

.cleansheet-upload-area h3 {
    margin: 0 0 12px 0;
    font-size: 22px;
    font-weight: 600;
    color: #1d1d1f;
}

.cleansheet-upload-area p {
    margin: 0 0 20px 0;
    color: #6e6e73;
    font-size: 16px;
}

.cleansheet-upload-area small {
    display: block;
    color: #8e8e93;
    font-size: 14px;
    margin-top: 12px;
}

.cleansheet-file-input {
    display: none;
}

/* Buttons */
.cleansheet-btn {
    display: inline-flex;
    align-items: center;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 48px;
    box-sizing: border-box;
    margin: 0 8px;
}

.cleansheet-btn-primary {
    background: linear-gradient(135deg, #007aff, #5856d6);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.cleansheet-btn-primary:hover {
    background: linear-gradient(135deg, #0056cc, #4640a6);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.4);
}

.cleansheet-btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #1d1d1f;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.cleansheet-btn-secondary:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.cleansheet-btn-success {
    background: linear-gradient(135deg, #34c759, #30d158);
    color: white;
    box-shadow: 0 4px 16px rgba(52, 199, 89, 0.3);
}

.cleansheet-btn-success:hover {
    background: linear-gradient(135deg, #28a745, #26d159);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(52, 199, 89, 0.4);
}

.cleansheet-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.cleansheet-btn-small {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
}

/* File Information Display */
.cleansheet-file-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.cleansheet-file-stat {
    text-align: center;
    min-width: 120px;
    margin: 10px;
}

.cleansheet-file-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 4px;
    display: block;
}

.cleansheet-file-stat-label {
    font-size: 14px;
    color: #6e6e73;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Settings Grid */
.cleansheet-settings-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 24px -10px;
}

.cleansheet-setting-card {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 20px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 280px;
    margin: 10px;
}

.cleansheet-setting-card:hover {
    border-color: #007aff;
    background: white;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.1);
}

.cleansheet-setting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cleansheet-setting-title {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0;
}

.cleansheet-setting-description {
    font-size: 14px;
    color: #6e6e73;
    margin: 0;
    line-height: 1.5;
}

/* Toggle Switch */
.cleansheet-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.cleansheet-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cleansheet-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: 0.3s ease;
}

.cleansheet-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cleansheet-toggle input:checked + .cleansheet-toggle-slider {
    background: linear-gradient(135deg, #007aff, #5856d6);
}

.cleansheet-toggle input:checked + .cleansheet-toggle-slider:before {
    transform: translateX(26px);
}

/* Data Preview Table */
.cleansheet-data-preview {
    overflow-x: auto;
    margin: 24px 0;
    border-radius: 12px;
    border: 1px solid #e5e5ea;
    background: white;
}

.cleansheet-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.cleansheet-preview-table th,
.cleansheet-preview-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f2f2f7;
}

.cleansheet-preview-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #1d1d1f;
    position: sticky;
    top: 0;
    z-index: 10;
}

.cleansheet-preview-table td {
    color: #6e6e73;
}

.cleansheet-preview-table tr:hover {
    background: rgba(0, 122, 255, 0.02);
}

/* Results Stats */
.cleansheet-results-stats {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.cleansheet-stat-card {
    background: linear-gradient(135deg, #34c759, #30d158);
    color: white;
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(52, 199, 89, 0.3);
    flex: 1;
    min-width: 200px;
    margin: 10px;
}

.cleansheet-stat-number {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
}

.cleansheet-stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Actions */
.cleansheet-actions {
    display: flex;
    justify-content: center;
    padding-top: 32px;
    border-top: 1px solid #f2f2f7;
    flex-wrap: wrap;
}

/* Loading States */
.cleansheet-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.cleansheet-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007aff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

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

.cleansheet-loading-text {
    font-size: 16px;
    color: #6e6e73;
    margin: 0;
}

/* Notifications */
.cleansheet-notification {
    padding: 16px 20px;
    border-radius: 12px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

.cleansheet-notification.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.cleansheet-notification.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.cleansheet-notification.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.cleansheet-notification.info {
    background: #cce7ff;
    color: #0066cc;
    border: 1px solid #99d6ff;
}

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

/* Hidden States */
.cleansheet-hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cleansheet-container {
        padding: 20px;
        margin: 20px 0;
    }
    
    .cleansheet-header {
        padding: 24px;
        margin: -20px -20px 24px -20px;
    }
    
    .cleansheet-header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cleansheet-logo-section {
        justify-content: center;
        margin-bottom: 20px;
    }
    
    .cleansheet-header-text h2 {
        font-size: 24px;
    }
    
    .cleansheet-section {
        padding: 24px;
    }
    
    .cleansheet-upload-area {
        padding: 40px 20px;
    }
    
    .cleansheet-settings-grid {
        margin: 24px 0;
    }
    
    .cleansheet-setting-card {
        min-width: 100%;
        margin: 10px 0;
    }
    
    .cleansheet-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .cleansheet-btn {
        min-width: 200px;
        justify-content: center;
        margin: 8px 0;
    }
    
    .cleansheet-file-info {
        flex-direction: column;
    }
    
    .cleansheet-file-stat {
        min-width: 100%;
        margin: 5px 0;
    }
    
    .cleansheet-progress {
        flex-direction: column;
    }
    
    .cleansheet-progress-divider {
        width: 2px;
        height: 20px;
        margin: 8px 0;
    }
    
    .cleansheet-progress-step {
        margin: 8px 0;
    }
}

@media (max-width: 480px) {
    .cleansheet-upload-area h3 {
        font-size: 18px;
    }
    
    .cleansheet-section-header h3 {
        font-size: 20px;
    }
    
    .cleansheet-results-stats {
        flex-direction: column;
    }
    
    .cleansheet-stat-card {
        min-width: 100%;
        margin: 10px 0;
    }
}

/* Animation Classes */
.cleansheet-fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.cleansheet-slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility Classes */
.cleansheet-text-center { text-align: center; }
.cleansheet-text-left { text-align: left; }
.cleansheet-text-right { text-align: right; }
.cleansheet-visible { display: block !important; }
.cleansheet-flex { display: flex; }
.cleansheet-mb-0 { margin-bottom: 0; }
.cleansheet-mb-16 { margin-bottom: 16px; }
.cleansheet-mb-24 { margin-bottom: 24px; }
.cleansheet-mt-16 { margin-top: 16px; }
.cleansheet-mt-24 { margin-top: 24px; }