:root {
    /* Colors */
    --bg-color: #09090b; /* Darker, more modern black */
    --surface-color: #18181b; /* Zinc-900 */
    --surface-hover: #27272a; /* Zinc-800 */
    --border-color: rgba(255, 255, 255, 0.08);
    
    --primary-color: #3b82f6; /* Blue-500 */
    --primary-hover: #2563eb; /* Blue-600 */
    --accent-color: #8b5cf6; /* Violet-500 */
    
    --text-primary: #f4f4f5; /* Zinc-100 */
    --text-secondary: #a1a1aa; /* Zinc-400 */
    --text-muted: #71717a; /* Zinc-500 */

    /* Spacing & Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(76, 29, 149, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.10) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.login-page {
    flex: 1;
    display: flex;
    flex-direction: column; /* Stack logo above card */
    align-items: center;
    justify-content: center;
    gap: 10px; /* Reduced gap */
}

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

/* Logo Outside Card */
.logo-wrapper {
    text-align: center;
    line-height: 0; /* Remove line-height spacing */
    padding: 0;
    margin: 0;
}

.logo-wrapper img {
    max-height: 240px; /* Reduced from 280px */
    width: auto;
    filter: drop-shadow(0 0 25px rgba(56, 189, 248, 0.4));
    transition: transform 0.5s ease;
    display: block; /* Remove inline image spacing */
}

.logo-wrapper img:hover {
    transform: scale(1.02);
}

/* Modern Login Card */
.login-card {
    background: rgba(18, 18, 18, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px; /* Slightly reduced radius */
    padding: 30px; /* Reduced padding from 40px */
    width: 100%;
    max-width: 360px; /* Reduced max-width from 400px */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.login-title {
    font-size: 1.25rem; /* Reduced from 1.5rem */
    font-weight: 600;
    margin-bottom: 20px; /* Reduced margin */
    color: #fff;
    letter-spacing: -0.025em;
    margin-top: 0;
}

/* Modern Inputs with Icons */
.form-group {
    margin-bottom: 15px; /* Reduced margin from 20px */
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px; /* Reduced margin */
    font-size: 0.8rem; /* Reduced font size */
    color: #a3a3a3;
    font-weight: 500;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    font-size: 0.9rem; /* Smaller icon */
    pointer-events: none;
    opacity: 0.7;
    z-index: 10;
}

input[type="text"],
input[type="password"],
input[type="email"] {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 35px;
    border-radius: var(--radius-md);
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    outline: none;
}

input::placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    background-color: var(--surface-hover);
}

/* Modern Button */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    width: 100%;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 5px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.alert {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #f87171;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* Nav & Layout for internal pages */
/* Modal Form Styling */
.grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.email-list {
    list-style: none;
    padding: 0;
}

/* Email List & Filters */
.email-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px; /* Standard padding */
    background: rgba(18, 18, 18, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    position: relative;
    /* overflow: hidden; REMOVED to allow tooltips to show outside */
    transition: all 0.2s;
}

/* Adjust padding when selection mode is active */
.email-list.selection-mode .email-item {
    padding-left: 45px;
}

.email-item.new-email {
    border-left: 4px solid #d946ef; /* Fuchsia-500 */
    background: rgba(217, 70, 239, 0.05);
}

.new-badge {
    position: absolute;
    top: 10px;
    left: 45px; /* Aligned with content */
    background: #d946ef;
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(217, 70, 239, 0.3);
}

/* Email Selection Mode */
.email-checkbox {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}

/* Show checkboxes when selection mode is active on container */
.email-list.selection-mode .email-checkbox {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.email-select-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.email-select-checkbox:hover {
    border-color: rgba(255,255,255,0.6);
}

.email-select-checkbox:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.email-select-checkbox:checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: white;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    margin-bottom: 8px;
    z-index: 9999; /* Very high z-index */
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
}

/* Filter Bar */
.filter-bar {
    background: rgba(18, 18, 18, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
}

.checkbox-wrapper-sm {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.checkbox-wrapper-sm:hover {
    color: var(--text-primary);
}

.checkbox-wrapper-sm input {
    /* display: none;  REMOVED to show default checkbox if custom icon fails, or use opacity */
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-wrapper-sm input:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-wrapper-sm input:checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: white;
}

.checkbox-wrapper-sm i {
    display: none; /* Hide the old icon approach */
}

.action-btn-sm {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s;
}

.action-btn-sm:hover {
    transform: scale(1.1);
}

.email-actions-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 5;
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(4px);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
}

.email-item:hover .email-actions-overlay {
    opacity: 1;
}

.action-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px;
    transition: all 0.2s;
}

.action-icon:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.action-icon.delete:hover {
    color: #ef4444; /* Red for delete */
}

.date-small {
    position: absolute;
    bottom: 15px;
    right: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.email-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #fff;
    flex-shrink: 0;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

/* Modal adjustments */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); /* Slightly lighter backdrop */
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: var(--spacing-lg); /* Reduced from 30px to 24px */
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 550px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

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

/* Profile Modal Styles */
.profile-layout {
    display: flex;
    gap: var(--spacing-xl);
}

.avatar-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--surface-hover);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.avatar-preview-lg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
}

.avatar-upload-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: 2px solid var(--surface-color);
    transition: all 0.2s;
}

.avatar-upload-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.profile-form {
    flex-grow: 1;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    justify-content: center;
    height: 100%;
    box-sizing: border-box;
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkbox-wrapper i {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.checkbox-wrapper input:checked + i {
    color: #22c55e; /* Green for WhatsApp */
}

textarea {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    resize: vertical;
}

textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    background-color: var(--surface-hover);
    outline: none;
}
