/* ===== BlueMarine Webmail - Stylesheet ===== */

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    text-decoration: underline;
}

/* ===== Header ===== */
.main-header {
    background: #2c3e50;
    color: white;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo a {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-email {
    color: #bdc3c7;
    font-size: 0.9rem;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn:hover {
    text-decoration: none;
}

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

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

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

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

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

.btn-block {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}

/* ===== Login Page ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

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

.login-box h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.login-subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: #34495e;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #dce1e6;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 200px;
}

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

/* ===== Alerts ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fee;
    color: #c0392b;
    border: 1px solid #fcc;
}

/* ===== Inbox Layout ===== */
.inbox-container {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
}

.sidebar {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    height: fit-content;
}

.sidebar h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #7f8c8d;
    margin-bottom: 0.75rem;
}

.folder-list {
    list-style: none;
}

.folder-list li a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    color: #2c3e50;
    font-size: 0.9rem;
}

.folder-list li a:hover {
    background: #ecf0f1;
    text-decoration: none;
}

.folder-list li a.active {
    background: #3498db;
    color: white;
}

/* ===== Email List ===== */
.email-list-section {
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

.section-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 1.1rem;
    color: #2c3e50;
}

.email-count {
    color: #7f8c8d;
    font-size: 0.85rem;
}

.email-list {
    display: flex;
    flex-direction: column;
}

.email-item {
    display: grid;
    grid-template-columns: 180px 1fr 140px;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #f0f3f5;
    color: #2c3e50;
    transition: background 0.15s;
}

.email-item:hover {
    background: #f8fafc;
    text-decoration: none;
}

.email-from {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-subject {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #555;
}

.email-date {
    font-size: 0.8rem;
    color: #95a5a6;
    text-align: right;
}

.empty-state {
    padding: 3rem;
    text-align: center;
    color: #95a5a6;
    font-size: 1rem;
}

/* ===== View Email ===== */
.view-email-container {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.email-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ecf0f1;
}

.email-header h1 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

.email-meta {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ecf0f1;
}

.email-meta div {
    margin-bottom: 0.25rem;
}

.email-body {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.email-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 4px;
}

.email-html {
    word-wrap: break-word;
}

.email-html img {
    max-width: 100%;
    height: auto;
}

.email-attachments {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

.email-attachments h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.email-attachments ul {
    list-style: none;
}

.email-attachments li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
}

.attachment-size {
    color: #95a5a6;
    font-size: 0.85rem;
}

.note {
    font-size: 0.85rem;
    color: #95a5a6;
    margin-top: 0.5rem;
    font-style: italic;
}

/* ===== Compose ===== */
.compose-container {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    max-width: 900px;
    margin: 0 auto;
}

.compose-container h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* ===== Footer ===== */
.main-footer {
    text-align: center;
    padding: 1rem;
    color: #95a5a6;
    font-size: 0.85rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .inbox-container {
        grid-template-columns: 1fr;
    }
    
    .email-item {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .email-date {
        text-align: left;
    }
    
    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .user-info {
        flex-wrap: wrap;
        justify-content: center;
    }
}


/* ===== Admin Dashboard ===== */
.admin-container {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.admin-container h1 {
    margin-bottom: 0.25rem;
    color: #2c3e50;
}

.admin-subtitle {
    color: #7f8c8d;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.metric-ok {
    border-left: 4px solid #27ae60;
}

.metric-warning {
    border-left: 4px solid #f39c12;
    background: #fffbf0;
}

.metric-error {
    border-left: 4px solid #e74c3c;
    background: #fff5f5;
}

.metric-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.metric-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #7f8c8d;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.metric-detail {
    font-size: 0.8rem;
    color: #95a5a6;
}

.metric-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    background: #3498db;
    border-radius: 3px;
    transition: width 0.3s;
}

.admin-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}


/* ===== Attachment Links ===== */
.attachment-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.attachment-link:hover {
    text-decoration: underline;
}

/* ===== Original Attachments ===== */
.original-attachments-list {
    list-style: none;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.original-attachments-list li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

/* ===== Delete Button ===== */
.btn-danger {
    background: #e74c3c;
    color: white;
}

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

.email-item-wrapper {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f0f3f5;
}

.email-item-wrapper .email-item {
    flex: 1;
    border-bottom: none;
}

.email-delete-btn {
    padding: 0.5rem 0.75rem;
    color: #e74c3c;
    font-size: 1.1rem;
    text-decoration: none;
    transition: background 0.15s;
    border-radius: 4px;
    margin-right: 0.5rem;
}

.email-delete-btn:hover {
    background: #fee;
    text-decoration: none;
}

/* ===== Section Actions ===== */
.section-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ===== Unread Badge ===== */
.unread-badge {
    display: inline-block;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    min-width: 18px;
    text-align: center;
}

/* ===== Search ===== */
.search-container {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.search-form {
    margin-bottom: 1.5rem;
}

.search-row {
    display: flex;
    gap: 0.75rem;
}

.search-row input[type="text"] {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid #dce1e6;
    border-radius: 4px;
    font-size: 0.95rem;
}

.search-row select {
    padding: 0.6rem 0.75rem;
    border: 1px solid #dce1e6;
    border-radius: 4px;
    font-size: 0.95rem;
    background: white;
}

.search-results {
    margin-top: 1.5rem;
}

.search-results h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.email-folder {
    font-size: 0.8rem;
    color: #3498db;
    font-weight: 600;
}

.search-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}
