/* static/style.css */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a1a;
}

.navbar {
    background: #DA0F7A;
    color: white;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.nav-brand { font-size: 18px; font-weight: 700; }
.nav-links { display: flex; gap: 8px; }
.nav-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
}
.nav-link:hover, .nav-link.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

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

.card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h1 { font-size: 24px; margin-bottom: 24px; }

.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
}
.form-group select,
.form-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}
.form-group input[type="file"] { font-size: 14px; }

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn-primary { background: #DA0F7A; color: white; }
.btn-primary:hover { background: #b80c66; }
.btn-primary:disabled { background: #ccc; cursor: not-allowed; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { background: #ccc; cursor: not-allowed; }
.btn-secondary { background: #6b7280; color: white; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
}
.table th { font-weight: 600; color: #6b7280; font-size: 12px; text-transform: uppercase; }
.table tr:hover { background: #f9fafb; }
.center { text-align: center; color: #9ca3af; }

.hidden { display: none !important; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert a { color: #DA0F7A; font-weight: 600; }

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 20px;
}
.status-badge.running { background: #dbeafe; color: #1d4ed8; }
.status-badge.completed { background: #d1fae5; color: #065f46; }
.status-badge.stopped { background: #fee2e2; color: #991b1b; }

.delivery-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.delivery-badge.sent { background: #e5e7eb; color: #6b7280; }
.delivery-badge.delivered { background: #dbeafe; color: #1d4ed8; }
.delivery-badge.read { background: #d1fae5; color: #065f46; }
.delivery-badge.failed { background: #fee2e2; color: #991b1b; }

.progress-section { margin-bottom: 24px; }
.progress-bar-container {
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-bar {
    height: 100%;
    background: #DA0F7A;
    border-radius: 12px;
    transition: width 0.3s;
}
.progress-text { text-align: center; font-size: 14px; color: #6b7280; }

.counters { display: flex; gap: 16px; margin-bottom: 20px; }
.counter {
    flex: 1;
    text-align: center;
    padding: 16px;
    border-radius: 8px;
}
.counter.success { background: #d1fae5; }
.counter.failed { background: #fee2e2; }
.counter-value { display: block; font-size: 32px; font-weight: 700; }
.counter-label { font-size: 12px; color: #6b7280; text-transform: uppercase; }

.log-section { margin-top: 24px; }
.log-container {
    background: #1a1a2e;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    height: 300px;
    overflow-y: auto;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
}
.log-entry.success { color: #34d399; }
.log-entry.failed { color: #f87171; }

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 24px;
    border-radius: 8px;
    background: #dc2626;
    color: white;
    font-size: 14px;
    z-index: 1000;
    animation: fadeIn 0.3s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}
.modal-header h2 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #6b7280; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #e5e7eb; text-align: right; }

.disabled { opacity: 0.5; pointer-events: none; }

/* --- Template source tabs --- */
.source-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}
.tab-btn {
    padding: 5px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.tab-btn:hover { background: #f3f4f6; color: #374151; }
.tab-btn.active {
    background: #DA0F7A;
    border-color: #DA0F7A;
    color: white;
}
.tab-panel { display: block; }
.tab-panel.hidden { display: none; }
.hint {
    display: block;
    color: #9ca3af;
    font-size: 12px;
    margin-top: 4px;
}

/* --- Remote browse row --- */
.file-pick-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.file-pick-display {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #f9fafb;
    color: #374151;
    cursor: default;
}
.btn-outline {
    padding: 8px 18px;
    border: 1px solid #DA0F7A;
    border-radius: 8px;
    background: white;
    color: #DA0F7A;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.btn-outline:hover { background: #DA0F7A; color: white; }
.btn-clear {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s;
}
.btn-clear:hover { color: #ef4444; }

/* --- Template browser modal list --- */
.template-list { list-style: none; padding: 0; margin: 0; }
.template-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
    border: 1px solid transparent;
}
.template-list-item:hover { background: #fdf2f8; border-color: #f9a8d4; }
.template-list-item.selected { background: #fce7f3; border-color: #DA0F7A; }
.template-icon { font-size: 22px; }
.template-item-name { font-size: 14px; font-weight: 500; color: #1f2937; }
.template-item-type { font-size: 12px; color: #9ca3af; }
.template-list-empty { color: #9ca3af; text-align: center; padding: 24px 0; font-size: 14px; }
.loading-text { color: #9ca3af; text-align: center; padding: 24px 0; }
