/* Unified Design System for Make.com Integration Hub */

/* CSS Variables for consistent theming */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 10px;
    --border-radius-sm: 5px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s ease;
}

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

/* Layout Components */
.main-content {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

/* Header Styles */
.header {
    background: var(--primary-gradient);
    color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5em;
    font-weight: 300;
}

.header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1.1em;
}

/* Card Components */
.card, .service-card, .stat-card, .tool-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.card:hover, .service-card:hover, .tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Grid Layouts */
.services-grid, .tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Status Indicators */
.status-indicator {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    display: inline-block;
}

.status-ready {
    background: #d4edda;
    color: #155724;
}

.status-loading {
    background: #fff3cd;
    color: #856404;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.status-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    margin-top: 10px;
    display: inline-block;
}

/* Buttons */
.btn, .action-button, .refresh-btn, .convert-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary, .action-button {
    background: var(--success-color);
    color: white;
}

.btn-primary:hover, .action-button:hover {
    background: #218838;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn:disabled, .action-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.refresh-btn, .convert-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.refresh-btn:hover, .convert-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Form Elements */
.upload-area {
    border: 2px dashed #ddd;
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    background: #fafafa;
    margin: 20px 0;
    transition: var(--transition);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #e3f2fd;
}

.upload-area.active {
    border-color: var(--success-color);
    background: #d4edda;
}

.file-input input[type="file"] {
    display: none;
}

.file-input label {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.file-input label:hover {
    background: var(--secondary-color);
}

/* Tables */
.files-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.files-table th,
.files-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.files-table th {
    background: var(--light-color);
    font-weight: 600;
}

.files-table tr:hover {
    background: var(--light-color);
}

/* File Type Labels */
.file-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    background: #e9ecef;
}

.file-type.pdf {
    background: #d4edda;
    color: #155724;
}

.file-type.excel {
    background: #cce7ff;
    color: #004085;
}

.file-type.image {
    background: #fff3cd;
    color: #856404;
}

/* Loading States */
.loading {
    display: none !important;
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading.show {
    display: block !important;
}

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

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

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
    width: 0%;
}

/* Alert/Result Messages */
.result, .error, .success, .info {
    padding: 15px;
    border-radius: var(--border-radius-sm);
    margin: 15px 0;
    border: 1px solid transparent;
}

.result.success, .success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.result.error, .error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.result.info, .info {
    background: #cce7ff;
    border-color: #b3d9ff;
    color: #004085;
}

/* Links */
.download-link, .download-button {
    color: var(--info-color);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.download-button {
    background: var(--info-color);
    color: white;
    display: inline-block;
    margin-top: 10px;
}

.download-link:hover, .download-button:hover {
    background: #138496;
    color: white;
}

/* System Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    background: var(--light-color);
    padding: 15px;
    border-radius: var(--border-radius-sm);
}

.info-label {
    font-weight: bold;
    color: #555;
    margin-bottom: 5px;
}

.info-value {
    color: var(--dark-color);
}

/* JSON Viewer */
.json-viewer {
    background: #2d3748;
    color: #a0aec0;
    padding: 15px;
    border-radius: var(--border-radius-sm);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    overflow-x: auto;
    margin: 10px 0;
    max-height: 300px;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.tab {
    padding: 12px 24px;
    background: #e9ecef;
    cursor: pointer;
    transition: var(--transition);
    border-right: 1px solid #dee2e6;
    flex: 1;
    text-align: center;
}

.tab:last-child {
    border-right: none;
}

.tab.active {
    background: var(--primary-color);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Statistics */
.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
}

/* Service Icons */
.service-icon, .tool-icon, .upload-icon {
    font-size: 3em;
    display: block;
    text-align: center;
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 10px;
    }
    
    .services-grid, .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .service-card, .card, .tool-card {
        padding: 15px;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .tab:last-child {
        border-bottom: none;
    }
}

/* Enhanced Notifications */
.notification {
    position: fixed;
    z-index: 10000;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    font-family: inherit;
    transition: var(--transition);
}

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

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

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

.notification-info {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #b3d9ff;
}

/* File validation feedback */
.file-validation-error {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: var(--border-radius-sm);
    margin: 10px 0;
    border: 1px solid #f5c6cb;
    font-size: 0.9em;
}

.file-validation-success {
    background: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: var(--border-radius-sm);
    margin: 10px 0;
    border: 1px solid #c3e6cb;
    font-size: 0.9em;
}

/* Enhanced loading states */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-lg);
}

.loading-spinner .spinner {
    border-top-color: var(--primary-color);
}

/* Connection status indicator */
.connection-status {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    z-index: 1000;
    transition: var(--transition);
}

.connection-status.online {
    background: #d4edda;
    color: #155724;
}

.connection-status.offline {
    background: #f8d7da;
    color: #721c24;
}

.connection-status.connecting {
    background: #fff3cd;
    color: #856404;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.fade-in { animation: fadeIn 0.3s ease-in; }
.fade-out { animation: fadeOut 0.3s ease-out; }

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

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