/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #fafafa;
    color: #1d1d1f;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Header */
.header {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #000 0%, #333 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #34c759;
}

.status-indicator.sending .status-dot {
    background-color: #ff9500;
    animation: pulse 2s infinite;
}

/* Settings Menu */
.settings-menu {
    position: relative;
}

.settings-button {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #86868b;
    transition: all 0.2s ease;
}

.settings-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

.settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.settings-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.dropdown-item svg {
    color: #86868b;
}

.dropdown-item span {
    font-size: 14px;
    font-weight: 500;
    color: #1d1d1f;
}

.status-indicator.error .status-dot {
    background-color: #ff3b30;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main content */
.main {
    flex: 1;
    padding: 40px 0;
}

/* Sections */
.section {
    margin-bottom: 48px;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 8px;
}

.section-header p {
    font-size: 16px;
    color: #86868b;
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.card {
    background-color: white;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.2s ease;
}

.card:hover {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.card-header {
    padding: 24px 24px 0;
}

.card-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
}

.card-content {
    padding: 24px;
}

/* Form elements */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 16px;
    background-color: white;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.help-text {
    margin-top: 8px;
}

.help-text a {
    color: #007aff;
    text-decoration: none;
    font-size: 14px;
}

.help-text a:hover {
    text-decoration: underline;
}

/* File upload areas */
.file-upload-area {
    border: 2px dashed rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: rgba(0, 0, 0, 0.02);
}

.file-upload-area:hover {
    border-color: rgba(0, 0, 0, 0.3);
    background-color: rgba(0, 0, 0, 0.04);
}

.file-upload-area.dragover {
    border-color: #007aff;
    background-color: rgba(0, 122, 255, 0.05);
}

.upload-content svg {
    color: #86868b;
    margin-bottom: 16px;
}

.upload-content p {
    font-size: 16px;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.upload-link {
    color: #007aff;
    cursor: pointer;
}

.upload-hint {
    font-size: 14px;
    color: #86868b;
}

/* File previews */
.template-preview,
.csv-preview {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 16px;
    background-color: rgba(0, 0, 0, 0.02);
}

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

.preview-header span {
    font-weight: 500;
    color: #1d1d1f;
}

.email-count {
    background-color: #007aff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.btn-remove {
    background: none;
    border: none;
    font-size: 20px;
    color: #86868b;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
}

/* Send summary */
.send-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    font-size: 14px;
    color: #86868b;
}

.summary-value {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
}

/* Buttons */
.send-controls {
    display: flex;
    gap: 12px;
}

.btn-primary,
.btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #007aff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0056cc;
}

.btn-primary:disabled {
    background-color: rgba(0, 0, 0, 0.1);
    color: #86868b;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
}

.btn-secondary:hover {
    background-color: rgba(0, 0, 0, 0.15);
}

/* Progress section */
.progress-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: #86868b;
    font-weight: 500;
}

/* Progress bar */
.progress-bar-container {
    margin-bottom: 32px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007aff 0%, #34c759 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

#progressPercent {
    font-weight: 600;
    color: #1d1d1f;
}

#progressStatus {
    color: #86868b;
}

/* Log container */
.log-container {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.log-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
}

.btn-clear {
    background: none;
    border: none;
    color: #007aff;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-clear:hover {
    background-color: rgba(0, 122, 255, 0.1);
}

.log-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 16px 20px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    background-color: #fafafa;
}

.log-entry {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: white;
    border-left: 3px solid transparent;
}

.log-entry.success {
    border-left-color: #34c759;
}

.log-entry.error {
    border-left-color: #ff3b30;
}

.log-entry.info {
    border-left-color: #007aff;
}

.log-timestamp {
    color: #86868b;
    font-size: 12px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal {
    background-color: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.settings-modal {
    max-width: 600px;
    width: 95%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 0;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #86868b;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #1d1d1f;
}

.modal-content {
    padding: 0 24px 24px;
}

.modal-content ol {
    padding-left: 20px;
    margin-bottom: 20px;
}

.modal-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.modal-note {
    padding: 16px;
    background-color: rgba(255, 149, 0, 0.1);
    border-radius: 8px;
    border-left: 3px solid #ff9500;
    font-size: 14px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}



/* Log styles */
.log-entry {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 14px;
    line-height: 1.4;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: #86868b;
    font-family: monospace;
    margin-right: 8px;
}

.log-content {
    max-height: 300px;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Success Notification */
.success-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #34c759;
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(52, 199, 89, 0.3);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 350px;
}

.success-notification.show {
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.notification-content svg {
    flex-shrink: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header-content {
        padding: 0 16px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .progress-stats {
        grid-template-columns: 1fr;
    }
    
    .send-controls {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        justify-content: center;
    }
    
    .modal {
        width: 95%;
        margin: 20px;
    }
}