@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2d6a4f;
    --secondary-color: #343a40;
    --background-color: #f8f9fa;
    --text-color: #1b4332;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
    --transition: all 0.3s ease;
    --accent-amber: #BC6C25;
    --accent-blue: #3498db;
    --accent-green: #2d6a4f;
}

/* ── Errands Header ── */
.errands-header {
    padding: 8px 16px;
    gap: 0.5rem;
    background: linear-gradient(135deg, #2c4a47, #3a5c5a);
    color: var(--white);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-align: center;
    border-bottom: 3px solid var(--accent-amber);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ── Twin Form Layout ── */
.twin-form-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #1e2d3d, #2d3d30);
}

.form-container {
    background: #1e2d3d;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(52, 152, 219, 0.2);
    transition: border-color 0.3s ease;
}

.form-container:focus-within {
    border-color: rgba(52, 152, 219, 0.5);
}

/* ── Customer Heading ── */
.customer-heading {
    font-size: 15px;
    color: white;
    margin-bottom: 12px;
    padding: 8px 12px;
    text-align: center;
    background: linear-gradient(135deg, #2c4a47, #3a5c5a);
    border-radius: 10px;
    border: 2px solid var(--accent-blue);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
}

.customer-heading::after {
    content: '▾';
    font-size: 12px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.customer-heading:hover {
    background: linear-gradient(135deg, #3a5c5a, #4a6c6a);
}

/* ── Form Fields ── */
.form-area {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.input-pair {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(52,152,219,0.2);
    border-radius: 8px;
    padding: 5px 8px;
    transition: border-color 0.2s ease;
}

.input-pair:focus-within {
    border-color: rgba(52,152,219,0.6);
    background: rgba(52,152,219,0.06);
}

.input-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    width: 110px;
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

.input-field {
    padding: 5px 10px;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 7px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    width: 100%;
    background-color: rgba(255,255,255,0.95);
    color: #1a1a2e;
    font-weight: 500;
}

.input-field::placeholder {
    color: #aaa;
    font-style: italic;
}

.input-field:focus {
    outline: none;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.3);
    border-color: var(--accent-blue);
}

/* ── Notes Textarea ── */
.notes-area {
    margin-top: 12px;
    display: flex;
    flex-grow: 1;
}

.notes-area textarea {
    min-height: 120px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(52,152,219,0.25);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    resize: vertical;
    background: rgba(255,255,255,0.95);
    color: #1a1a2e;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.notes-area textarea:focus {
    border-color: var(--accent-blue);
    outline: none;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.2);
}

/* ── Form Action Buttons ── */
.form-action {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.copy-button, .clear-button, .archive-button {
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    letter-spacing: 0.3px;
}

.copy-button {
    background: linear-gradient(135deg, #2980b9, var(--accent-blue));
    color: white;
    box-shadow: 0 2px 8px rgba(41,128,185,0.35);
}

.clear-button {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: white;
    box-shadow: 0 2px 8px rgba(231,76,60,0.35);
}

.archive-button {
    background: linear-gradient(135deg, #d68910, #f39c12);
    color: white;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(243,156,18,0.35);
}

.copy-button:hover, .clear-button:hover, .archive-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    opacity: 0.95;
}

.copy-button:active, .clear-button:active, .archive-button:active {
    transform: translateY(0);
}

/* ── Archive Section ── */
.archived-errands-section {
    padding: 16px;
    margin-top: 0;
    background: linear-gradient(135deg, #1e2d3d, #2d3d30);
}

.archive-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0f3964, #1a4a7a);
    border: 1px solid rgba(52,152,219,0.25);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    flex-wrap: wrap;
    gap: 8px;
}

.archive-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.4px;
}

.archive-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Archive action buttons shared style */
.archive-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
    letter-spacing: 0.2px;
}

#clear-archive-btn {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: white;
    box-shadow: 0 2px 6px rgba(231,76,60,0.3);
}

#clear-archive-btn:hover {
    background: linear-gradient(135deg, #a93226, #c0392b);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231,76,60,0.4);
}

#download-excel-btn {
    background: linear-gradient(135deg, #196f3d, #1a9103);
    color: white;
    box-shadow: 0 2px 6px rgba(26,145,3,0.3);
}

#download-excel-btn:hover {
    background: linear-gradient(135deg, #117a3e, #27ae60);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26,145,3,0.4);
}

#copy-all-btn {
    background: linear-gradient(135deg, #0e86d4, #09b4c0);
    color: white;
    box-shadow: 0 2px 6px rgba(9,180,192,0.3);
}

#copy-all-btn:hover {
    background: linear-gradient(135deg, #0c74bb, #09a0aa);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(9,180,192,0.4);
}

/* ── Archive Table ── */
.archived-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    overflow-x: auto;
}

#archived-errands-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
}

#archived-errands-table th {
    padding: 10px 12px;
    text-align: left;
    background: linear-gradient(135deg, #1e3a5f, #2c5282);
    color: white;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.3px;
    border-bottom: 2px solid rgba(52,152,219,0.4);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

#archived-errands-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
    color: #2d3748;
    vertical-align: top;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#archived-errands-table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

#archived-errands-table tbody tr:hover {
    background-color: #ebf8ff;
}

/* ── Table Action Buttons ── */
.restore-btn, .delete-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin: 2px;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.restore-btn {
    background: linear-gradient(135deg, #d68910, #f39c12);
    color: white;
}

.restore-btn:hover {
    background: linear-gradient(135deg, #b7770d, #d68910);
    transform: translateY(-1px);
}

.delete-btn {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: white;
}

.delete-btn:hover {
    background: linear-gradient(135deg, #a93226, #c0392b);
    transform: translateY(-1px);
}

/* ── No Archives Message ── */
.no-archives-message {
    text-align: center;
    padding: 32px 20px;
    color: #a0aec0;
    font-style: italic;
    font-size: 13px;
    display: none;
    background: white;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
    .twin-form-box {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .archive-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .archive-actions {
        width: 100%;
        justify-content: flex-start;
    }
}
