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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header h1 i {
    margin-right: 10px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    font-size: 14px;
    opacity: 0.9;
    margin-right: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-primary:hover {
    background-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* Search Form */
.search-form-container {
    background-color: #f8f9fa;
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
}

.search-form {
    max-width: 800px;
    margin: 0 auto;
}

.search-inputs {
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.input-group label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background-color: white;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-search {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    height: fit-content;
}

.btn-search:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Main Content */
.main-content {
    display: flex;
    height: calc(100vh - 140px);
}

/* Email List */
.email-list-container {
    width: 40%;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.email-list-header {
    padding: 20px 20px 10px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.email-list-header h2 {
    font-size: 18px;
    color: #333;
}

.email-count {
    background-color: #f0f0f0;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
}

.loading-spinner {
    padding: 40px;
    text-align: center;
    color: #666;
    font-size: 16px;
}

.loading-spinner i {
    margin-right: 10px;
    font-size: 20px;
}

.email-list {
    flex: 1;
    overflow-y: auto;
}

.email-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.email-item:hover {
    background-color: #f8f9fa;
}

.email-item.selected {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.email-item.unread {
    background-color: #fff3e0;
}

.email-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: #ff9800;
}

.email-subject {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.email-sender {
    color: #666;
    font-size: 13px;
    margin-bottom: 3px;
}

.email-timestamp {
    color: #999;
    font-size: 12px;
}

.no-emails {
    padding: 60px 20px;
    text-align: center;
    color: #999;
}

.no-emails i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Email Detail */
.email-detail-container {
    width: 60%;
    display: flex;
    flex-direction: column;
}

.email-detail {
    flex: 1;
    overflow-y: auto;
}

.email-detail-placeholder {
    padding: 60px 40px;
    text-align: center;
    color: #999;
}

.email-detail-placeholder i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.email-detail-placeholder p {
    font-size: 18px;
}

.email-content {
    padding: 30px;
}

.email-content-header {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.email-content-subject {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.email-content-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #666;
    font-size: 14px;
}

.email-content-sender {
    font-weight: 500;
}

.email-content-timestamp {
    color: #999;
}

.email-content-body {
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.email-content-body.html {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    max-height: 400px;
    overflow-y: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        height: auto;
    }
    
    .email-list-container,
    .email-detail-container {
        width: 100%;
    }
    
    .email-list-container {
        max-height: 50vh;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group {
        min-width: auto;
    }
    
    .btn-search {
        width: 100%;
        margin-top: 10px;
    }
}

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

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #333;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 10px;
}

.login-header h1 i {
    color: #667eea;
    margin-right: 10px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.form-group label i {
    margin-right: 8px;
    color: #667eea;
    width: 16px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

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

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.login-footer p {
    color: #999;
    font-size: 12px;
    margin: 0;
}

.login-footer i {
    margin-right: 5px;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 20px;
}

.flash-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

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

.flash-success {
    background-color: #efe;
    color: #363;
    border: 1px solid #cfc;
}

.flash-message i {
    font-size: 16px;
}

/* Header Logout Button */
.header-logout {
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.header-logout:hover {
    background-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* Admin Page Styles */
.admin-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.admin-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 800px;
}

.admin-header {
    text-align: center;
    margin-bottom: 30px;
}

.admin-header h1 {
    color: #333;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 10px;
}

.admin-header h1 i {
    color: #667eea;
    margin-right: 10px;
}

.admin-header p {
    color: #666;
    font-size: 14px;
}

.admin-form {
    margin-bottom: 30px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.form-help {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.message-container {
    margin-bottom: 20px;
}

.message-content {
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.message-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.validation-results {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.validation-results h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
}

.validation-results h4 {
    color: #555;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 600;
}

.email-list {
    margin-bottom: 15px;
}

.email-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delegate-email {
    color: #666;
    font-size: 12px;
    font-style: italic;
}

.error-list {
    margin-bottom: 15px;
}

.error-item {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 5px;
    font-size: 13px;
}

.text-success {
    color: #28a745 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-muted {
    color: #6c757d !important;
}

/* Password Generator Styles */
.password-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.password-input-group input {
    flex: 1;
}

.btn-generate {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-generate:hover {
    background: #218838;
    transform: translateY(-1px);
}

.password-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    margin: 0;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.password-length {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 15px;
    background-color: #e3f2fd;
    border-radius: 6px;
    border: 1px solid #bbdefb;
}

.password-length label {
    font-size: 13px;
    color: #1976d2;
    font-weight: 500;
    margin: 0;
}

.password-length input[type="range"] {
    flex: 1;
    margin: 0;
}

.password-length span {
    font-size: 13px;
    color: #1976d2;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Admin Management Styles */
.admin-nav {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.admin-nav .btn {
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.admin-nav .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.user-management-section {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.action-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.user-info-section {
    background-color: #e3f2fd;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #bbdefb;
    margin-top: 20px;
}

.user-info-section h3 {
    color: #1976d2;
    margin-bottom: 15px;
}

#userDetails {
    background-color: white;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.flash-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Form Actions Styling */
.form-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
}

.form-actions .btn {
    transition: all 0.3s ease;
}

/* Removed problematic CSS that was interfering with button visibility */

/* Admin Section Divider */
.admin-section-divider {
    margin: 40px 0 30px 0;
    padding: 20px 0;
    border-top: 2px solid #e9ecef;
}

.admin-section-divider h2 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 24px;
}

.admin-section-divider p {
    color: #6c757d;
    margin: 0;
}

/* User Selection Styling */
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 16px;
    background-color: white;
    transition: border-color 0.3s ease;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

select option {
    padding: 10px;
}

select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Email dropdown specific styling */
#emailInput {
    min-width: 250px;
}

#emailInput option:first-child {
    color: #6c757d;
    font-style: italic;
}

/* Scrollbar Styling */
.email-list::-webkit-scrollbar,
.email-detail::-webkit-scrollbar {
    width: 8px;
}

.email-list::-webkit-scrollbar-track,
.email-detail::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.email-list::-webkit-scrollbar-thumb,
.email-detail::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.email-list::-webkit-scrollbar-thumb:hover,
.email-detail::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
