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

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

/* Navigation */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: #34495e;
}

.username {
    color: #ecf0f1;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Messages */
.messages {
    margin-bottom: 1rem;
}

.message {
    background-color: #3498db;
    color: white;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

/* Login */
.login-box {
    max-width: 400px;
    margin: 4rem auto;
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #555;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="password"],
textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #3498db;
}

textarea {
    resize: vertical;
}

/* Buttons */
.btn {
    background-color: #3498db;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

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

.btn-secondary {
    background-color: #95a5a6;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.btn-danger {
    background-color: #e74c3c;
}

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

.btn-link {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    text-decoration: underline;
}

.btn-link:hover {
    color: #c0392b;
}

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

thead {
    background-color: #34495e;
    color: white;
}

th, td {
    padding: 1rem;
    text-align: left;
}

tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: #f8f9fa;
    cursor: pointer;
}

.contacts-table tbody tr:last-child {
    border-bottom: none;
}

/* Unread indicator */
.unread-indicator {
    color: #27ae60;
    font-size: 1.2rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Contact header */
.contact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.contact-header h1 {
    margin: 0;
    color: #2c3e50;
}

.contact-actions {
    display: flex;
    gap: 0.5rem;
}

.contact-actions .btn-small {
    min-width: 70px;
}

/* Contact details */
.contact-details {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.details-table {
    box-shadow: none;
}

.details-table th {
    background-color: transparent;
    color: #7f8c8d;
    font-weight: 500;
    width: 150px;
    padding: 0.5rem 1rem;
}

.details-table td {
    padding: 0.5rem 1rem;
}

.details-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
}

.details-table tbody tr:last-child {
    border-bottom: none;
}

.details-table tbody tr:hover {
    background-color: transparent;
    cursor: default;
}

/* Interactions */
.interactions-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.interactions-section h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.interaction-toggle-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.new-interaction-form {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px solid;
}

.new-interaction-form input[type="text"],
.new-interaction-form textarea {
    margin-bottom: 0.5rem;
}

.form-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-subtitle {
    font-size: 0.85rem;
    font-weight: normal;
    opacity: 0.8;
}

/* Note Form Styling */
.note-form {
    background-color: #fffbf0;
    border-color: #f39c12;
}

.note-header {
    color: #e67e22;
}

.btn-note {
    background-color: #f39c12;
}

.btn-note:hover {
    background-color: #e67e22;
}

/* Email Form Styling */
.email-form {
    background-color: #f0f8ff;
    border-color: #3498db;
}

.email-header {
    color: #2980b9;
}

.warning {
    color: #e74c3c;
    font-weight: bold;
}

.btn-email {
    background-color: #3498db;
}

.btn-email:hover {
    background-color: #2980b9;
}

.interactions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 2px solid #ecf0f1;
}

.interaction {
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid;
}

/* Note interaction */
.interaction-note {
    border-left-color: #f39c12;
    background-color: #fffbf0;
}

/* Outbound email interaction */
.interaction-email_out {
    border-left-color: #3498db;
    background-color: #f0f8ff;
}

/* Inbound email interaction */
.interaction-email_in {
    border-left-color: #27ae60;
    background-color: #f0fdf4;
}

.interaction-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.interaction-badge {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.note-badge {
    background-color: #f39c12;
    color: white;
}

.email-out-badge {
    background-color: #3498db;
    color: white;
}

.email-in-badge {
    background-color: #27ae60;
    color: white;
}

.interaction-user {
    font-weight: 500;
    color: #2c3e50;
}

.interaction-content {
    white-space: pre-wrap;
    color: #333;
    margin-top: 0.5rem;
}

.email-subject, .email-from, .email-to {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.25rem;
}

/* Contact form */
.contact-form {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Admin */
.admin-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.admin-section h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.admin-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.users-table tbody tr:hover {
    cursor: default;
}

/* Empty states */
.empty-state {
    text-align: center;
    color: #7f8c8d;
    padding: 2rem;
}

.empty-state a {
    color: #3498db;
    text-decoration: none;
}

.empty-state a:hover {
    text-decoration: underline;
}

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

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

/* Links */
a {
    color: #3498db;
}

a:hover {
    color: #2980b9;
}
