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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

nav {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 2rem;
    opacity: 0.8;
}

.nav-links a:hover {
    opacity: 1;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

h2 {
    margin: 2rem 0 1rem;
    color: #2c3e50;
}

table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #34495e;
    color: white;
    font-weight: 500;
}

tr:hover {
    background: #f8f9fa;
}

tr.opened {
    background: #e8f5e9;
}

tr.opened:hover {
    background: #c8e6c9;
}

.open-count {
    font-weight: bold;
    color: #27ae60;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn:hover {
    background: #2980b9;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

.create-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.create-form label {
    display: block;
    margin-bottom: 1.5rem;
    color: #555;
}

.create-form input,
.create-form textarea {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.create-form textarea {
    min-height: 100px;
    resize: vertical;
}

.create-form button {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
}

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

.track-info {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.track-info p {
    margin-bottom: 0.5rem;
}

.code-block {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.code-block pre {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.code-block code {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.user-agent {
    font-size: 0.85rem;
    color: #666;
    max-width: 300px;
}

.empty {
    background: white;
    padding: 2rem;
    text-align: center;
    border-radius: 8px;
    color: #666;
}

.empty a {
    color: #3498db;
}

/* Login page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2c3e50, #3498db);
}

.login-container {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 2rem;
}

.login-container input {
    display: block;
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.login-container button {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
}

.error {
    background: #fee;
    color: #c00;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    text-align: center;
}

/* Collapsible pixel details */
.pixel-details {
    margin-top: 2rem;
}

.pixel-details summary {
    cursor: pointer;
    padding: 1rem;
    background: #ecf0f1;
    border-radius: 4px;
    font-weight: 500;
    color: #7f8c8d;
}

.pixel-details summary:hover {
    background: #e0e5e7;
}

.pixel-details[open] summary {
    margin-bottom: 1rem;
    border-radius: 4px 4px 0 0;
}

.track-metadata {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.track-metadata p {
    margin-bottom: 0.5rem;
}

.track-metadata p:last-child {
    margin-bottom: 0;
}

/* New email list layout */
.email-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.email-row {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: white;
    gap: 1.5rem;
}

.email-row:hover {
    background: #fafafa;
}

.email-row.has-opens {
    border-left: 3px solid #27ae60;
}

.email-row.expanded {
    background: #f8f9fa;
}

.email-main {
    flex: 1;
    min-width: 0;
}

.email-recipients {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.recipient-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #555;
}

.recipient-pill.opened {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}

.email-subject {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-meta {
    font-size: 0.85rem;
    color: #888;
}

.email-stats {
    text-align: right;
    min-width: 180px;
}

.opens-count {
    font-weight: 600;
    color: #27ae60;
}

.proxy-indicator {
    font-weight: normal;
    font-size: 0.8rem;
    color: #999;
    margin-left: 0.25rem;
}

.last-open {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.25rem;
}

.email-actions {
    display: flex;
    align-items: center;
}

.expand-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    text-decoration: none;
}

.expand-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* Expandable recipient details */
.recipient-details {
    background: #f8f9fa;
    border-left: 3px solid #3498db;
}

.recipient-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem 0.75rem 2rem;
    gap: 1rem;
    border-bottom: 1px solid #eee;
}

.recipient-row:last-child {
    border-bottom: none;
}

.recipient-row.has-opens {
    background: #f0faf0;
}

.recipient-email {
    flex: 1;
    font-size: 0.9rem;
    color: #555;
}

.recipient-stats {
    font-size: 0.85rem;
    color: #27ae60;
    min-width: 150px;
}

.recipient-time {
    color: #888;
    margin-left: 0.5rem;
}

/* Proxy detection badges */
.proxy-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    font-weight: 500;
    vertical-align: middle;
}

.proxy-badge.apple {
    background: #f0f0f0;
    color: #666;
    border: 1px solid #ccc;
}

.proxy-badge.google {
    background: #e8f0fe;
    color: #1a73e8;
    border: 1px solid #c2d7f9;
}

.proxy-open {
    opacity: 0.6;
}

.proxy-open:hover {
    opacity: 1;
}

.proxy-count {
    color: #999;
    font-size: 0.85em;
    font-weight: normal;
}
