/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Roboto', sans-serif;
    background: #0b0e17;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(99, 179, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(168, 85, 247, 0.05) 0%, transparent 50%);
    color: #c8cdd5;
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== LAYOUT ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container h2 {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

.logo-icon {
    font-size: 28px;
    vertical-align: middle;
    margin-right: 6px;
}

h2, h3 {
    color: #fff;
    margin-bottom: 16px;
}

/* ===== EMAIL BOX (Top Control Panel) ===== */
.email-box {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    width: 100%;
    max-width: 620px;
    margin: 0 auto 20px;
}

/* ===== EMAIL INPUT ROW ===== */
.email-input-container {
    display: flex;
    align-items: center;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
}

.email-input-container:focus-within {
    border-color: rgba(108, 99, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
}

.email-input-container input {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-family: 'Inter', monospace;
    text-align: center;
    border: none;
    background: transparent;
    color: #e8ecf1;
    outline: none;
    letter-spacing: 0.3px;
    min-width: 0;
}

.email-input-container input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* Action buttons in input row */
.input-action-btn {
    padding: 12px 14px;
    font-size: 14px;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.input-action-btn:active {
    transform: scale(0.92);
}

.input-action-btn.btn-enter {
    color: #8b83ff;
    font-size: 16px;
    font-weight: 700;
}

.input-action-btn.btn-enter:hover {
    background: rgba(108, 99, 255, 0.15);
    color: #a59dff;
}

.input-action-btn.btn-copy {
    color: rgba(255, 255, 255, 0.6);
}

.input-action-btn.btn-copy:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* ===== ACTION BUTTONS ROW ===== */
.button-container {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.btn-custom {
    flex: 1;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #fff;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

.btn-custom:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

.btn-icon-inner {
    font-size: 12px;
}

.btn-refresh {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.btn-new {
    background: linear-gradient(135deg, #00b09b, #6bbf59);
}

.btn-delete {
    background: linear-gradient(135deg, #e03e3e, #d45d5d);
}

.btn-settings {
    background: linear-gradient(135deg, #4a5568, #718096);
}

.btn-back {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 16px;
    max-width: 160px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: none;
}

/* Spinning animation for refresh button */
.btn-refresh.spinning .btn-icon-inner {
    animation: spin 0.6s ease;
}

/* ===== CONNECTION STATUS ===== */
.connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    padding: 4px 0;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.status-dot.connected {
    background: #34d399;
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
    animation: pulse-green 2s ease-in-out infinite;
}

.status-dot.connecting {
    background: #fbbf24;
    animation: pulse-yellow 1s ease-in-out infinite;
}

.status-dot.disconnected {
    background: #f87171;
    animation: pulse-red 1s ease-in-out infinite;
}

.status-dot.polling {
    background: #60a5fa;
    animation: pulse-blue 2s ease-in-out infinite;
}

.status-text {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 3px rgba(52, 211, 153, 0.3); }
    50% { box-shadow: 0 0 10px rgba(52, 211, 153, 0.7); }
}

@keyframes pulse-yellow {
    0%, 100% { box-shadow: 0 0 3px rgba(251, 191, 36, 0.3); }
    50% { box-shadow: 0 0 10px rgba(251, 191, 36, 0.7); }
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 3px rgba(248, 113, 113, 0.3); }
    50% { box-shadow: 0 0 10px rgba(248, 113, 113, 0.7); }
}

@keyframes pulse-blue {
    0%, 100% { box-shadow: 0 0 3px rgba(96, 165, 250, 0.3); }
    50% { box-shadow: 0 0 10px rgba(96, 165, 250, 0.7); }
}

/* ===== EMAIL LIST CONTAINER ===== */
.email-list {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.email-list h3 {
    font-size: 18px;
    color: #fff;
    font-weight: 600;
}

.email-list p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 6px;
}

.hint {
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.25) !important;
    margin-top: 4px !important;
}

/* ===== EMPTY STATE ===== */
.empty-message {
    text-align: center;
    padding: 40px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.empty-icon {
    font-size: 44px;
    margin-bottom: 14px;
    animation: float 3s ease-in-out infinite;
    opacity: 0.8;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-top: 2px solid #6c63ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 10px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== EMAIL TABLE ===== */
.email-list table {
    width: 100%;
    border-collapse: collapse;
}

.email-list thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.email-list th,
.email-list td {
    padding: 12px 18px;
    text-align: left;
}

.email-list th {
    background: rgba(108, 99, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(108, 99, 255, 0.15);
}

.email-list th:first-child {
    border-radius: 0;
}

.email-list th:last-child {
    border-radius: 0;
}

.email-list td {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.email-list tbody tr {
    transition: background 0.15s ease;
}

.email-list tbody tr:hover {
    background: rgba(108, 99, 255, 0.08);
    cursor: pointer;
}

.email-list tbody tr:active {
    background: rgba(108, 99, 255, 0.14);
}

/* Sender column styling */
.email-list td:first-child {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Date column styling */
.email-list td:last-child {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    white-space: nowrap;
    min-width: 130px;
}

/* Row slide-in animation */
.email-row-enter {
    animation: slideIn 0.3s ease forwards;
    opacity: 0;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== EMAIL DETAIL ===== */
.email-detail-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    padding: 20px;
}

.email-detail {
    text-align: left;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.email-detail h3 {
    font-size: 18px;
    margin-bottom: 14px;
    color: #fff;
    font-weight: 600;
    line-height: 1.4;
}

.email-meta {
    background: rgba(255, 255, 255, 0.04);
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.email-meta p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    text-align: left;
    margin: 3px 0;
}

.email-meta strong {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

/* ===== OTP SUB-ROW (Email List) ===== */
.otp-row {
    cursor: default !important;
}

.otp-row td {
    padding: 0 !important;
    border-bottom: 1px solid rgba(52, 211, 153, 0.1) !important;
}

.otp-row-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(52, 211, 153, 0.04));
    cursor: pointer;
    transition: all 0.2s ease;
    border-top: 1px dashed rgba(52, 211, 153, 0.15);
}

.otp-row-content:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(52, 211, 153, 0.08));
}

.otp-row-content:active {
    transform: scale(0.99);
}

.otp-row-icon {
    font-size: 14px;
}

.otp-row-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(52, 211, 153, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.otp-row-code {
    font-size: 18px;
    font-weight: 800;
    color: #34d399;
    letter-spacing: 3px;
    font-family: 'Inter', monospace;
}

.otp-row-copy {
    margin-left: auto;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 500;
    transition: color 0.2s ease;
}

.otp-row-content:hover .otp-row-copy {
    color: rgba(255, 255, 255, 0.7);
}

/* ===== OTP DETAIL ROW (Email Detail View) ===== */
.otp-detail-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(52, 211, 153, 0.06));
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.otp-detail-row:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(52, 211, 153, 0.12));
    border-color: rgba(52, 211, 153, 0.4);
    box-shadow: 0 2px 12px rgba(52, 211, 153, 0.15);
}

.otp-detail-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(52, 211, 153, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.otp-detail-value {
    font-size: 20px;
    font-weight: 700;
    color: #34d399;
    letter-spacing: 4px;
    font-family: 'Inter', monospace;
}

.otp-detail-copy {
    margin-left: auto;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
    transition: color 0.2s ease;
}

.otp-detail-row:hover .otp-detail-copy {
    color: rgba(255, 255, 255, 0.7);
}

.email-detail hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin: 14px 0;
}

.fade-in {
    animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.email-body {
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
    overflow-x: auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex: 1;
}

.email-body a {
    color: #8b83ff;
    text-decoration: none;
}

.email-body a:hover {
    text-decoration: underline;
    color: #a59dff;
}

.email-iframe {
    width: 100%;
    min-height: 400px;
    flex: 1;
    border: none;
    border-radius: 10px;
    background: #fff;
    margin-top: 14px;
}

/* ===== HIDDEN ===== */
.hidden { display: none; }

/* ===== NEW EMAIL FORM ===== */
.new-container {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 28px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    max-width: 520px;
    margin: 60px auto;
}

.new-container h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
}

.input-table {
    display: grid;
    grid-template-columns: 3fr 1fr 1fr;
    gap: 10px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus,
.input-group select:focus {
    border-color: rgba(108, 99, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.input-group select option {
    background: #1a1d2e;
    color: #e0e0e0;
}

.btn-icon {
    background: linear-gradient(135deg, #6c63ff, #5a52d5);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}

.btn-cancel {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    cursor: pointer;
    margin-top: 16px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ===== NOTIFICATION ===== */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(16, 185, 129, 0.9);
    backdrop-filter: blur(12px);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.notification.error {
    background: rgba(239, 68, 68, 0.9);
}

.notification.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-16px);
    pointer-events: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .container {
        max-width: 100%;
        padding: 16px 12px 12px;
        min-height: 100vh;
    }
    .email-box {
        max-width: 100%;
        padding: 16px;
    }
    .new-container { max-width: 100%; margin: 20px 12px; }
    .input-table { grid-template-columns: 1fr; }
    .button-container { flex-direction: column; gap: 6px; }
    .btn-custom { margin: 0; padding: 10px; }
    .email-input-container { flex-direction: row; }
    .email-body { font-size: 12px; padding: 14px; }
    .container h2 { font-size: 20px; }
    .email-list th, .email-list td { padding: 10px 10px; font-size: 11px; }
    .email-detail { padding: 16px; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(108, 99, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(108, 99, 255, 0.5);
}

/* ===== SELECTION ===== */
::selection {
    background: rgba(108, 99, 255, 0.3);
    color: #fff;
}
