/* style.css - Clean modern design for Form Submissions App */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6;
    --danger: #ef4444;
    --new: #3b82f6;
    --read: #64748b;
    --replied: #10b981;
    --archived: #94a3b8;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

/* Header */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

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

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.total-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: var(--card);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.note {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.note code {
    background: #f1f5f9;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
}

input[type="password"],
input[type="search"],
select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: white;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: #f1f5f9;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* Filters */
.filters {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.search-group {
    flex: 1;
    min-width: 250px;
}

.search-group input {
    flex: 1;
}

/* Table */
.table-wrapper {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
    box-shadow: var(--shadow);
}

.submissions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.submissions-table th,
.submissions-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.submissions-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.submissions-table tr:hover {
    background: #f8fafc;
}

.submissions-table tr.status-new {
    background: #eff6ff;
}

.preview {
    max-width: 200px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actions {
    white-space: nowrap;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.status-form select {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    width: auto;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-read { background: #e2e8f0; color: #475569; }
.badge-replied { background: #d1fae5; color: #065f46; }
.badge-archived { background: #f1f5f9; color: #64748b; }

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    background: var(--card);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.submission-detail h2 {
    margin-bottom: 0.5rem;
    padding-right: 2rem;
}

.detail-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.detail-grid {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.message-box {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.message-box p {
    margin-top: 0.5rem;
    white-space: pre-wrap;
}

.user-agent {
    margin-top: 1rem;
    font-size: 0.85rem;
}

.user-agent code {
    display: block;
    background: #f1f5f9;
    padding: 0.5rem;
    border-radius: 4px;
    word-break: break-all;
    margin-top: 0.3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .submissions-table th:nth-child(5),
    .submissions-table td:nth-child(5) {
        display: none;
    }
}
