* {
    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;
    padding: 12px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.03)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.04)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

header {
    background: linear-gradient(135deg, #1e90ff 0%, #63b3ff 100%);
    color: white;
    padding: 32px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    50% { transform: translate(-50%, -50%) rotate(180deg); }
}

header h1 {
    font-size: 2.2em;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 2;
}

header p {
    font-size: 1em;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 2;
    line-height: 1.4;
}

.form-section {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section:hover {
    background: rgba(30, 144, 255, 0.02);
}

.form-section h3 {
    color: #1a202c;
    margin-bottom: 20px;
    font-size: 1.25em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #2d3748;
    font-weight: 500;
    font-size: 0.95em;
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    -webkit-appearance: none;
    appearance: none;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: #1e90ff;
    box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.input-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.input-group small {
    display: block;
    margin-top: 6px;
    color: #718096;
    font-size: 13px;
    line-height: 1.4;
}

.file-input-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-input-display {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    padding: 24px 16px;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    background: #f7fafc;
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
}

.file-input-display:hover {
    border-color: #1e90ff;
    background: rgba(30, 144, 255, 0.05);
}

.file-input-display svg {
    margin-bottom: 4px;
}

.file-input-display span {
    font-size: 14px;
    color: #4a5568;
}

button {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #1e90ff 0%, #63b3ff 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(30, 144, 255, 0.3);
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 144, 255, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 12px rgba(30, 144, 255, 0.2);
}

.loader {
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result {
    margin: 20px;
    padding: 18px 20px;
    border-radius: 10px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    line-height: 1.5;
}

.result.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.result.error {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.email-stats {
    margin-top: 10px;
    font-size: 13px;
    opacity: 0.9;
}

.failed-emails {
    margin-top: 10px;
    max-height: 80px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.1);
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
}

.template-preview {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.template-preview strong {
    color: #1e90ff;
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
}

.template-preview div {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

#message_help {
    color: #718096;
    font-style: italic;
}

.section-icon {
    font-size: 1.1em;
    margin-right: 6px;
}

/* Tablet styles */
@media (min-width: 768px) {
    body {
        padding: 20px;
    }
    
    .container {
        border-radius: 20px;
    }
    
    header {
        padding: 40px 32px;
    }
    
    header h1 {
        font-size: 2.6em;
        margin-bottom: 12px;
    }
    
    header p {
        font-size: 1.1em;
    }
    
    .form-section {
        padding: 32px;
    }
    
    .form-section h3 {
        font-size: 1.3em;
        margin-bottom: 24px;
    }
    
    .input-group {
        margin-bottom: 24px;
    }
    
    .input-group input,
    .input-group textarea,
    .input-group select {
        padding: 16px 20px;
        border-radius: 12px;
    }
    
    .input-group textarea {
        min-height: 140px;
    }
    
    .file-input-display {
        flex-direction: row;
        padding: 20px;
        border-radius: 12px;
    }
    
    .file-input-display svg {
        margin-bottom: 0;
        margin-right: 8px;
    }
    
    button {
        padding: 18px 32px;
        font-size: 18px;
        border-radius: 12px;
    }
    
    .result {
        margin: 24px 32px;
        padding: 20px 24px;
        border-radius: 12px;
        font-size: 15px;
    }
    
    .template-preview {
        padding: 20px;
        border-radius: 12px;
        margin-top: 16px;
        font-size: 14px;
    }
    
    .section-icon {
        font-size: 1.2em;
        margin-right: 8px;
    }
}

/* Desktop styles */
@media (min-width: 1024px) {
    body {
        padding: 24px;
    }
    
    .container {
        border-radius: 24px;
    }
    
    header {
        padding: 48px 40px;
    }
    
    header h1 {
        font-size: 2.8em;
    }
    
    header p {
        font-size: 1.2em;
    }
    
    .form-section {
        padding: 40px;
    }
    
    .form-section h3 {
        font-size: 1.4em;
    }
    
    .result {
        margin: 24px 40px;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .container {
        border-radius: 12px;
    }
    
    header {
        padding: 24px 16px;
    }
    
    header h1 {
        font-size: 1.8em;
        margin-bottom: 6px;
    }
    
    header p {
        font-size: 0.9em;
    }
    
    .form-section {
        padding: 20px 16px;
    }
    
    .form-section h3 {
        font-size: 1.1em;
        margin-bottom: 16px;
    }
    
    .input-group {
        margin-bottom: 18px;
    }
    
    .input-group input,
    .input-group textarea,
    .input-group select {
        padding: 12px 14px;
        font-size: 16px;
        border-radius: 8px;
    }
    
    .input-group textarea {
        min-height: 100px;
    }
    
    .file-input-display {
        padding: 20px 12px;
        border-radius: 8px;
    }
    
    .file-input-display span {
        font-size: 13px;
    }
    
    button {
        padding: 14px 20px;
        font-size: 15px;
        border-radius: 8px;
        min-height: 50px;
    }
    
    .result {
        margin: 16px;
        padding: 16px;
        border-radius: 8px;
        font-size: 13px;
    }
    
    .template-preview {
        padding: 14px;
        border-radius: 8px;
        font-size: 12px;
    }
    
    .failed-emails {
        max-height: 60px;
        font-size: 11px;
    }
}