:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #1f2937;
    --light: #f9fafb;
    --gray: #6b7280;
    --gray-light: #e5e7eb;
    --border: #d1d5db;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px 30px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2rem;
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tag {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--success);
    font-weight: 500;
}

.connection-status i {
    font-size: 0.7rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Main Content */
main {
    position: relative;
}

/* Dashboard */
.dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

@media (max-width: 992px) {
    .dashboard {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.timer-card, .email-card {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow-lg);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.timer-card h2, .email-card h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark);
    font-weight: 600;
}

/* TIMER DISPLAY */
.timer-display {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: var(--radius);
    border: 2px solid var(--border);
}

.time {
    font-size: 3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-family: 'Courier New', monospace;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px;
    border-radius: var(--radius-sm);
    background: white;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timer-normal {
    color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.timer-warning {
    color: var(--warning);
    background: linear-gradient(135deg, var(--warning), #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.timer-danger {
    color: var(--danger);
    background: linear-gradient(135deg, var(--danger), #f87171);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.timer-progress {
    height: 10px;
    background: var(--gray-light);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--info));
    width: 100%;
    transition: width 1s linear;
    border-radius: 5px;
}

.progress-warning {
    background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.progress-danger {
    background: linear-gradient(90deg, var(--danger), #f87171);
}

.duration-selector {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.duration-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.duration-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.duration-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

/* Email Generator - SỬA LẠI */
.email-generator {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.email-display-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.email-display {
    background: linear-gradient(135deg, var(--light), white);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    padding: 25px;
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
    color: var(--dark);
    word-break: break-all;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.1);
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

/* Email Customize - THÊM MỚI */
.email-customize {
    background: var(--light);
    border-radius: var(--radius-sm);
    padding: 20px;
    border: 1px solid var(--border);
}

.customize-row {
    display: flex;
    gap: 15px;
}

@media (max-width: 768px) {
    .customize-row {
        flex-direction: column;
        gap: 10px;
    }
}

.customize-group {
    flex: 1;
}

.customize-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.customize-group input,
.customize-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: white;
    transition: all 0.3s;
}

.customize-group input:focus,
.customize-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.email-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    min-height: 50px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.btn.secondary {
    background: white;
    color: var(--dark);
    border: 2px solid var(--border);
}

.btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn.copy {
    background: linear-gradient(135deg, var(--success), #34d399);
    color: white;
}

.btn.copy:hover {
    background: linear-gradient(135deg, #059669, #10b981);
}

/* Inbox Section */
.inbox-section {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-light);
}

.inbox-header h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.inbox-stats {
    display: flex;
    gap: 20px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gray);
    font-weight: 500;
    padding: 8px 12px;
    background: var(--light);
    border-radius: var(--radius-sm);
}

.stat.unread {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.stat i {
    font-size: 0.8rem;
}

.inbox-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 25px;
    min-height: 500px;
}

@media (max-width: 992px) {
    .inbox-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.email-list-container {
    border-right: 2px solid var(--gray-light);
    padding-right: 20px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 992px) {
    .email-list-container {
        border-right: none;
        border-bottom: 2px solid var(--gray-light);
        padding-right: 0;
        padding-bottom: 20px;
        margin-bottom: 20px;
        max-height: 400px;
    }
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--light);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 15px;
    margin-bottom: 20px;
    transition: all 0.3s;
    flex-shrink: 0;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-box i {
    color: var(--gray);
    margin-right: 10px;
}

#email-search {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 1rem;
    font-weight: 500;
    width: 100%;
}

.email-list {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 10px;
}

.email-list::-webkit-scrollbar {
    width: 6px;
}

.email-list::-webkit-scrollbar-track {
    background: var(--gray-light);
    border-radius: 3px;
}

.email-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.empty-inbox, .no-email-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
    height: 100%;
}

.empty-inbox i, .no-email-selected i {
    font-size: 3.5rem;
    color: var(--gray-light);
    margin-bottom: 20px;
}

.empty-inbox h3, .no-email-selected h3 {
    color: var(--dark);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.hint {
    font-size: 0.9rem;
    color: var(--primary);
    font-style: italic;
    margin-top: 10px;
}

/* Email Item */
.email-item {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.email-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.1);
}

.email-item.unread {
    border-left: 4px solid var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.email-item.unread::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.email-item.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.email-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.email-sender {
    font-weight: 600;
    color: var(--dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
    font-size: 0.95rem;
}

.email-time {
    font-size: 0.85rem;
    color: var(--gray);
    white-space: nowrap;
    font-weight: 500;
}

.email-subject {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem;
}

.email-preview {
    font-size: 0.9rem;
    color: var(--gray);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

/* Email Viewer */
.email-viewer {
    overflow-y: auto;
    max-height: 500px;
    padding: 10px;
}

.email-viewer::-webkit-scrollbar {
    width: 6px;
}

.email-viewer::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.email-detail {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-header {
    border-bottom: 2px solid var(--gray-light);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.sender-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 250px;
}

.sender-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

.sender-text {
    flex: 1;
    min-width: 0;
}

.sender-text h3 {
    font-size: 1.1rem;
    color: var(--dark);
    margin-bottom: 4px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sender-text p {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-date {
    color: var(--gray);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 10px;
    background: var(--light);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    flex-shrink: 0;
}

.email-subject-large {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-light);
    word-break: break-word;
    line-height: 1.4;
}

.email-body {
    line-height: 1.7;
    color: var(--dark);
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 1rem;
}

.email-body a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px dotted var(--primary);
    font-weight: 500;
}

.email-body a:hover {
    text-decoration: underline;
}

.email-body pre {
    background: var(--light);
    padding: 15px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border: 1px solid var(--border);
}

.email-body code {
    background: var(--light);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--danger);
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .features {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .features {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.feature {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.feature i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.feature h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--dark);
    font-weight: 600;
}

.feature p {
    color: var(--gray);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Instructions Section */
.instructions {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.instructions h2 {
    font-size: 1.3rem;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark);
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
}

.step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.step-content h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: var(--dark);
    font-weight: 600;
}

.step-content p {
    color: var(--gray);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Footer */
footer {
    text-align: center;
    padding: 25px;
    color: var(--gray);
    border-top: 1px solid var(--gray-light);
    margin-top: 30px;
}

.disclaimer {
    color: var(--warning);
    font-style: italic;
    margin-top: 5px;
    font-size: 0.9rem;
    font-weight: 500;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Toast Customization */
.toast-success {
    background: linear-gradient(135deg, var(--success), #34d399) !important;
    font-weight: 500 !important;
    border-radius: var(--radius-sm) !important;
}

.toast-error {
    background: linear-gradient(135deg, var(--danger), #f87171) !important;
    font-weight: 500 !important;
    border-radius: var(--radius-sm) !important;
}

.toast-info {
    background: linear-gradient(135deg, var(--info), #60a5fa) !important;
    font-weight: 500 !important;
    border-radius: var(--radius-sm) !important;
}

.toast-warning {
    background: linear-gradient(135deg, var(--warning), #fbbf24) !important;
    font-weight: 500 !important;
    border-radius: var(--radius-sm) !important;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }
    
    .timer-card, .email-card, .inbox-section, .instructions {
        padding: 20px;
    }
    
    .email-actions {
        flex-direction: column;
    }
    
    .time {
        font-size: 2.5rem;
    }
    
    .stat {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
    
    .email-display {
        font-size: 1.1rem;
        padding: 20px 15px;
    }
    
    .btn {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    .inbox-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .inbox-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .time {
        font-size: 2rem;
    }
    
    .email-display {
        font-size: 1rem;
        padding: 15px 10px;
        min-height: 100px;
    }
    
    .duration-selector {
        flex-direction: column;
    }
    
    .duration-btn {
        padding: 10px;
    }
    
    .feature, .step {
        padding: 15px;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .email-date {
        align-self: flex-start;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
}