:root {
    --primary-color: #25D366;
    --primary-dark: #128C7E;
    --secondary-color: #34B7F1;
    --danger-color: #DC3545;
    --warning-color: #FFC107;
    --success-color: #28A745;
    --dark-color: #1F2937;
    --light-color: #F8F9FA;
    --border-color: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 40px 20px;
}

header h1 {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1em;
    opacity: 0.95;
}

.main-content {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.card {
    padding: 30px;
    border-bottom: 1px solid var(--border-color);
}

.card:last-child {
    border-bottom: none;
}

h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: var(--dark-color);
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95em;
}

.input-field, .textarea-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
    font-family: inherit;
}

.input-field:focus, .textarea-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.textarea-field {
    resize: vertical;
    min-height: 120px;
}

small {
    display: block;
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 0.85em;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    background: var(--light-color);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(37, 211, 102, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(37, 211, 102, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    color: var(--text-secondary);
}

.file-info {
    margin-top: 20px;
    padding: 15px;
    background: var(--light-color);
    border-radius: 8px;
}

.file-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

.btn-remove {
    background: var(--danger-color);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-remove:hover {
    background: #C82333;
    transform: rotate(90deg);
}

/* Variables */
.variables-info {
    margin-top: 20px;
    padding: 15px;
    background: #F0FDF4;
    border-radius: 8px;
    border: 1px solid #86EFAC;
}

.variables-info h4 {
    margin-bottom: 10px;
    color: var(--primary-dark);
    font-size: 0.9em;
}

.variables-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.variable-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.85em;
    font-family: 'Courier New', monospace;
}

/* Message Preview */
.message-preview {
    margin-top: 20px;
    padding: 15px;
    background: #F8F9FA;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.message-preview h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 0.9em;
}

.preview-content {
    background: white;
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    font-size: 0.95em;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--light-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Action Section */
.action-section {
    padding: 30px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#sendButton {
    position: relative;
    min-width: 200px;
}

.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

#sendButton.loading .btn-text {
    display: none;
}

#sendButton.loading .spinner {
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Status Messages */
.status-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    display: none;
    animation: slideIn 0.3s ease-out;
}

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

.status-message.success {
    background: var(--success-color);
    color: white;
}

.status-message.error {
    background: var(--danger-color);
    color: white;
}

.status-message.warning {
    background: var(--warning-color);
    color: var(--dark-color);
}

/* Results Section */
.results-section, .errors-section {
    margin-top: 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    padding: 20px;
    background: var(--light-color);
    border-radius: 8px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card .stat-label {
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Error List */
.error-item {
    padding: 10px;
    background: #FEF2F2;
    border-left: 4px solid var(--danger-color);
    margin-bottom: 10px;
    border-radius: 4px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    animation: modalSlide 0.3s ease-out;
}

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

.modal-content h3 {
    margin-bottom: 15px;
    color: var(--dark-color);
}

.modal-buttons {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Links */
.link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Template Download */
.template-download {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
}

/* Footer */
footer {
    margin-top: 40px;
    text-align: center;
    color: white;
    padding: 20px;
}

footer p {
    margin-bottom: 10px;
    opacity: 0.9;
}

.copyright {
    font-size: 0.9em;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .card {
        padding: 20px;
    }
    
    .stat-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-large {
        width: 100%;
        justify-content: center;
    }
}
