* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    background-color: #f5f7fa;
    margin: 0;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 950px;
    margin: 0 auto;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    padding: 25px 30px;
}

.container.narrow { max-width: 460px; }

/* ===== شريط علوي ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.topbar h2 { margin: 0; color: #2c3e50; font-size: 22px; }
.topbar h2 i { color: #3498db; margin-left: 8px; }

.user-box { display: flex; align-items: center; gap: 12px; font-size: 15px; color: #555; }
.user-box .name { font-weight: 600; color: #2c3e50; }

/* ===== أزرار ===== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color .2s, transform .1s;
    font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background-color: #3498db; color: #fff; }
.btn-primary:hover { background-color: #2980b9; }
.btn-success { background-color: #27ae60; color: #fff; }
.btn-success:hover { background-color: #219150; }
.btn-danger  { background-color: #e74c3c; color: #fff; }
.btn-danger:hover  { background-color: #c0392b; }
.btn-light   { background-color: #ecf0f1; color: #2c3e50; }
.btn-light:hover   { background-color: #dfe6e9; }
.btn-block { width: 100%; justify-content: center; font-size: 17px; padding: 13px; }

/* ===== نماذج ===== */
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 7px; font-size: 15px; color: #2c3e50; font-weight: 500; }
.field input {
    width: 100%;
    height: 46px;
    border: 1px solid #d5dbdb;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 16px;
    font-family: inherit;
}
.field input:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 3px rgba(52,152,219,.15); }

.auth-title { text-align: center; color: #2c3e50; margin: 5px 0 22px; }
.auth-title i { color: #3498db; }
.auth-switch { text-align: center; margin-top: 18px; color: #7f8c8d; font-size: 15px; }
.auth-switch a { color: #3498db; text-decoration: none; font-weight: 600; }

.alert { padding: 12px 15px; border-radius: 8px; margin-bottom: 18px; font-size: 15px; }
.alert-error { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }
.alert-ok { background: #e8f6ef; color: #219150; border: 1px solid #c3e6cb; }

/* ===== توليد ===== */
.generate-box {
    background: #f8fbff;
    border: 1px solid #e1ecf7;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}
.generate-box h3 { margin: 0 0 15px; color: #2c3e50; font-size: 18px; }
.generate-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.generate-row .field { margin: 0; flex: 1 1 220px; }
.hint-text { font-size: 13px; color: #95a5a6; margin-top: 6px; }

/* ===== إحصائيات ===== */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat {
    flex: 1 1 140px;
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}
.stat .num { font-size: 26px; font-weight: bold; color: #3498db; }
.stat.used .num { color: #27ae60; }
.stat.avail .num { color: #e67e22; }
.stat .lbl { font-size: 13px; color: #7f8c8d; margin-top: 4px; }

/* ===== قائمة الإيميلات ===== */
.list-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.list-toolbar h3 { margin: 0; color: #2c3e50; font-size: 18px; }

.email-row {
    margin: 10px 0;
    padding: 14px 18px;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    background-color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    transition: all .2s ease;
}
.email-row:hover { border-color: #3498db; box-shadow: 0 3px 10px rgba(52,152,219,.1); }
.email-row.used { background-color: #f4f7f5; border-color: #cfe3d6; }

.email-main { display: flex; align-items: center; gap: 12px; flex: 1 1 300px; min-width: 0; }
.email-text { font-size: 16px; color: #2c3e50; font-weight: 500; word-break: break-all; cursor: pointer; }
.email-row.used .email-text { color: #95a5a6; text-decoration: line-through; }

.badge { font-size: 12px; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.badge-used { background: #27ae60; color: #fff; }
.used-by { font-size: 13px; color: #7f8c8d; }

.email-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.email-controls input {
    height: 38px; border: 1px solid #d5dbdb; border-radius: 7px;
    padding: 0 10px; font-size: 14px; font-family: inherit; width: 150px;
}
.btn-sm { padding: 8px 12px; font-size: 13px; }

.no-emails { text-align: center; padding: 40px 20px; color: #7f8c8d; font-size: 17px; }
.no-emails i { font-size: 46px; margin-bottom: 15px; color: #bdc3c7; display: block; }

.footer { text-align: center; margin-top: 28px; color: #95a5a6; font-size: 14px; padding-top: 18px; border-top: 1px solid #eee; }

/* ===== توست ===== */
.toast-wrap { position: fixed; top: 20px; left: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: #27ae60; color: #fff; padding: 13px 22px; border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15); font-weight: 500; font-size: 15px;
    display: flex; align-items: center; gap: 10px; opacity: 0; transform: translateX(-20px);
    transition: all .3s ease;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast.err { background: #e74c3c; }
